Notes/硬件开发笔记/ESP32/ESP32开发板资料.md
2024-10-17 15:36:48 +08:00

32 lines
974 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# **ESP32 DevKit v1 资料**
链接https://github.com/Nicholas3388/LuaNode
## 一、GPIO的基本操作
可以看到LED灯的IO口是D2那么对应的闪烁LED灯的例程如下所示
```c
#define BLINK_GPIO 2
void app_main(void)
{
gpio_reset_pin(BLINK_GPIO);
/* Set the GPIO as a push/pull output */
gpio_set_direction(BLINK_GPIO, GPIO_MODE_OUTPUT);
while(1) {
/* Blink off (output low) */
printf("Turning off the LED\n");
gpio_set_level(BLINK_GPIO, 0);
vTaskDelay(1000 / portTICK_PERIOD_MS);
/* Blink on (output high) */
printf("Turning on the LED\n");
gpio_set_level(BLINK_GPIO, 1);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
```
开发板上的D表示GPIO的意思D2就表示GPIO2其他IO口也是类似的。
<img src="C:\Users\Administrator\AppData\Roaming\Typora\typora-user-images\image-20220828213702936.png" alt="image-20220828213702936" style="zoom:50%;" />