内存笔记
/
文章
分类
标签
时间线
Github
/
文章
分类
标签
时间线
Github
web 1python 6人工智能 17c 2数据结构 1线性代数 16esp32 1
[ESP32]点亮LED灯

Date: 2025/3/4Category: c, esp32Tag: c, esp32

实操步骤:

1.将15号pin连接到指定的LED灯的针脚 (硬件准备)

2.复制basic中的blink示例的代码

3.通过宏定义定下输出的端口 #define LED_BUILTIN 15

4.选择开发板:工具->开发板->ESP32 DEV Module

5.再选择对应的端口

6.上传

示例代码

#define LED_BUILTIN 15

// the setup function runs once when you press reset or power the board
void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(1000);                      // wait for a second
  digitalWrite(LED_BUILTIN, LOW);   // turn the LED off by making the voltage LOW
  delay(1000);                      // wait for a second
}
蜀ICP备2024116061号-1 川公网安备51140202000488号