參考資訊:
https://arduino.github.io/arduino-cli/0.31/installation/
https://sites.google.com/site/arduinochutiyan/home/nodemcu/arduino-%E7%92%B0%E5%A2%83%E5%BB%BA%E7%BD%AE-%E5%AE%89%E8%A3%9Desp8266%E9%96%8B%E7%99%BC%E6%9D%BF
步驟如下:
1. 連接板子到PC
2. 執行如下命令
$ cd $ arduino-cli sketch new blink $ vim blink/blink.ino
#define LED 16 void setup() { pinMode(LED, OUTPUT); } void loop() { digitalWrite(LED, HIGH); delay(1000); digitalWrite(LED, LOW); delay(1000); }
$ arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 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 esp8266:esp8266:nodemcuv2 blink esptool.py v3.0 Serial port /dev/ttyUSB0 Connecting.... Chip is ESP8266EX Features: WiFi Crystal is 26MHz MAC: 2c:3a:e8:10:dc:82 Uploading stub... Running stub... Stub running... Configuring flash size... Auto-detected Flash size: 4MB Compressed 265616 bytes to 195725... Writing at 0x00000000... (8 %) Writing at 0x00004000... (16 %) Writing at 0x00008000... (25 %) Writing at 0x0000c000... (33 %) Writing at 0x00010000... (41 %) Writing at 0x00014000... (50 %) Writing at 0x00018000... (58 %) Writing at 0x0001c000... (66 %) Writing at 0x00020000... (75 %) Writing at 0x00024000... (83 %) Writing at 0x00028000... (91 %) Writing at 0x0002c000... (100 %) Wrote 265616 bytes (195725 compressed) at 0x00000000 in 17.2 seconds (effective 123.7 kbit/s)... Hash of data verified. Leaving... Hard resetting via RTS pin... New upload port: /dev/ttyUSB0 (serial)
完成