- ESP32 Arduino 源码库:arduino-esp32
- ESP32 Arduino 环境搭建说明:About Arduino ESP32
其他软件环境需求:
- Git 环境
1、安装 Arduino 软件
可在 Arduino 官网 获取 Windows 端 Arduino 安装包,如下:

使用如下 .exe 一键安装 Arduino 环境

安装完成

2、导入 arduino-esp32 库
在 Arduino IDE 中导入 arduino-esp32 库,参见"Installing using Arduino IDE"
- 稳定版本链接:
https://espressif.github.io/arduino-esp32/package_esp32_index.json
- 开发版本链接:
https://espressif.github.io/arduino-esp32/package_esp32_dev_index.json
打开 File —> Preferences 界面

将如上链接复制到 Additional boards manager URLs 下

点击 OK ,将打印如下安装进程

3、添加库管理
打开 Tools —> Manage Libraries 界面

4、选择开发板
打开 Select Board —> Select other board and port 界面

在搜索栏搜索 ESP32 系列的开发板

点击 OK 后,跳出安装界面

选择 Yes ,立刻安装,会进入如下安装进程,此过程需要等待一段时间

安装内容会在黑框打印

安装完成后,会在 Tools —> Board —> esp32 界面增加 ESP32 系列开发板选项

在 File —> Examples —> ESP32 目录下也会增加许多 ESP32 的测试例程。

接下来可以打开任意一个例程来进行测试,在 Tools 目录选择开发板型号,配置 COM 口

直接点击下载按钮,即可完成工程编译和固件下载

最后,可以打开右上角的 Serial Monitor 界面来查看固件运行日志


以下提供一个基于 GPIO26 点灯示例测试代码
/*
BlinkRGB
Demonstrates usage of onboard RGB LED on some ESP dev boards.
Calling digitalWrite(RGB_BUILTIN, HIGH) will use hidden RGB driver.
RGBLedWrite demonstrates controll of each channel:
void neopixelWrite(uint8_t pin, uint8_t red_val, uint8_t green_val, uint8_t blue_val)
WARNING: After using digitalWrite to drive RGB LED it will be impossible to drive the same pin
with normal HIGH/LOW level
*/
//#define RGB_BRIGHTNESS 64 // Change white brightness (max 255)
#define RGB_BUILTIN 26
// the setup function runs once when you press reset or power the board
void setup() {
// No need to initialize the RGB LED
Serial.begin(115200);
pinMode(RGB_BUILTIN, OUTPUT);
Serial.printf("GPIO is %d \r\n", RGB_BUILTIN);
}
// the loop function runs over and over again forever
void loop() {
#ifdef RGB_BUILTIN
digitalWrite(RGB_BUILTIN, HIGH);
Serial.printf("Light on \r\n ");
delay(1000);
digitalWrite(RGB_BUILTIN, LOW); // Turn the RGB LED off
Serial.printf("Light off \r\n");
delay(1000);
#endif
}


















