參考資訊:
https://arduino.github.io/arduino-cli/0.31/installation/
步驟如下:
1. 連接板子到PC
2. 執行如下命令
$ cd $ arduino-cli sketch new blink $ vim blink/blink.ino
#define LED 2 void setup() { pinMode(LED, OUTPUT); } void loop() { digitalWrite(LED, HIGH); delay(1000); digitalWrite(LED, LOW); delay(1000); }
$ $ arduino-cli compile --fqbn esp32:esp32:nodemcu-32s blink $ arduino-cli board list Port Protocol Type Board Name FQBN Core /dev/ttyUSB0 serial Serial Port (USB) Unknown $ arduino-cli upload --port /dev/ttyUSB0 --fqbn esp32:esp32:nodemcu-32s blink esptool.py v4.6 Serial port /dev/ttyUSB0 Connecting..... Chip is ESP32-D0WDQ6 (revision v1.0) Features: WiFi, BT, Dual Core, Coding Scheme None Crystal is 40MHz MAC: 30:ae:a4:1c:68:ec Uploading stub... Running stub... Stub running... Configuring flash size... Flash will be erased from 0x00001000 to 0x00006fff... Flash will be erased from 0x00008000 to 0x00008fff... Flash will be erased from 0x0000e000 to 0x0000ffff... Flash will be erased from 0x00010000 to 0x00051fff... Compressed 23376 bytes to 15314... Writing at 0x00001000... (100 %) Wrote 23376 bytes (15314 compressed) at 0x00001000 in 1.7 seconds (effective 113.0 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 383.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 635.9 kbit/s)... Hash of data verified. Compressed 267680 bytes to 148557... Writing at 0x00010000... (10 %) Writing at 0x0001b97b... (20 %) Writing at 0x00024977... (30 %) Writing at 0x00029af8... (40 %) Writing at 0x0002ef81... (50 %) Writing at 0x00034307... (60 %) Writing at 0x0003cf48... (70 %) Writing at 0x00046075... (80 %) Writing at 0x0004b735... (90 %) Writing at 0x00050ed0... (100 %) Wrote 267680 bytes (148557 compressed) at 0x00010000 in 13.2 seconds (effective 162.5 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin... New upload port: /dev/ttyUSB0 (serial)
完成