ESP32C3使用Audiuno搭建开发环境入门
ESP32C3使用Audiuno搭建开发环境入门,编写led闪烁和串口输出的测试程序。完整流程,详细入门截图。
1、下载Audiuno
https://www.arduino.cc/en/software
2、安装后,切换语言
File > Preferences…
Language选择语言:简体中文
3、设置开发版管理器地址url
- esp32的地址:https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
4、下载esp32库
-
工具 > 开发板 > 开发板管理器。
-
搜索esp32,下载:esp32 by Espressif Systems
5、选择开发板,并配置参数
- 工具 > 开发板 > ESP32 Arduino > ESP32C3 Dev Module
参数:
- USB CDC On Boot: “Enabled”:(注意)设置Disabled,发送串口的数据看不到
其他设置参考:
6、编写闪烁程序,并给串口发送数据
- 设置引脚8,板子内置led
- 串口波特率:115200
// 定义 LED 连接的引脚
const int ledPin = 8;
void setup() {
// 初始化串口通信,设置波特率为 115200
Serial.begin(115200);
// 将 LED 引脚设置为输出模式
pinMode(ledPin, OUTPUT);
}
void loop() {
// 点亮 LED
digitalWrite(ledPin, HIGH);
// 向串口发送数据
Serial.println("LED is on.");
// 延迟 1 秒
delay(500);
// 熄灭 LED
digitalWrite(ledPin, LOW);
// 向串口发送数据
Serial.println("LED is off.");
// 延迟 1 秒
delay(500);
}
7、烧录
查看串口:右键“我的电脑” > “设备管理器”。USB串行设备(COM3)就是我们连接设备的串口:COM3
工具 > 端口:选择 COM3
Sketch uses 297972 bytes (22%) of program storage space. Maximum is 1310720 bytes.
Global variables use 12768 bytes (3%) of dynamic memory, leaving 314912 bytes for local variables. Maximum is 327680 bytes.
esptool.py v4.8.1
Serial port COM3
Connecting....
Chip is ESP32-C3 (QFN32) (revision v0.4)
Features: WiFi, BLE, Embedded Flash 4MB (XMC)
Crystal is 40MHz
MAC: a0:85:e3:49:df:e8
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00004fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x00059fff...
Compressed 19440 bytes to 12466...
Writing at 0x00000000... (100 %)
Wrote 19440 bytes (12466 compressed) at 0x00000000 in 0.3 seconds (effective 523.1 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.1 seconds (effective 485.8 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Writing at 0x0000e000... (100 %)
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 614.0 kbit/s)...
Hash of data verified.
Compressed 299136 bytes to 164144...
Writing at 0x00010000... (9 %)
Writing at 0x0001be35... (18 %)
Writing at 0x0002438d... (27 %)
Writing at 0x0002a3f9... (36 %)
Writing at 0x00030ee2... (45 %)
Writing at 0x00037c40... (54 %)
Writing at 0x0003e132... (63 %)
Writing at 0x000449af... (72 %)
Writing at 0x0004a988... (81 %)
Writing at 0x0005136e... (90 %)
Writing at 0x00058eac... (100 %)
Wrote 299136 bytes (164144 compressed) at 0x00010000 in 2.6 seconds (effective 927.2 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting with RTC WDT...
8、监视串口输出
点击右上角的图标
注意:选择波特率:115200
看到串口输出灯亮和灭的输出