After a lot of searching over the network, this is what I have ended up with. This is intentionally made such that even a absolute beginner is able to follow, so uses fixed paths.
Note: I am not using the --additional-urls
flag since it didn't work for me back then, you may try it.
First ensure that your PC is detecting the NodeMCU atleast.
arduino-cli board list
This should output something like:
Port Protocol Type Board Name FQBN Core
/dev/ttyUSB0 serial Serial Port (USB) Unknown
Create a file named .cli-config.yml
with the below content.
By default, arduino searches for this file in
/usr/local/bin/.cli-config.yml
, but I don't recommend you creating such a file in the root partition. You can create it anywhere you want, we just need the path to that file.
board_manager:
additional_urls:
- http://arduino.esp8266.com/stable/package_esp8266com_index.json
Install the core packages for support for the NodeMCU board.
The package is called esp8266
. If you install through the arduino IDE boards manager, you will see this name.
Use the path to the
.cli-config.yml
after--config-file
, for example, if it's in the current directory (.
) itself, run this:
arduino-cli core install esp8266:esp8266 --config-file ./.cli-config.yml
Now if you check the output of
arduino-cli board listall
. You will find aNodeMCU 1.0
board.
In case you are using the Blynk
library, use this to install that library:
arduino-cli lib install Blynk
Then, to compile your sketch/code, run:
Assuming the code is in
nodemcu/nodemcu.ino
arduino-cli compile --fqbn esp8266:esp8266:nodemcuv2 nodemcu
Then upload to the board:
Replace
/dev/ttyUSB0
with the port given in the output ofarduino-cli board list
in Step 0.
arduino-cli upload -p /dev/ttyUSB0 --fqbn esp8266:esp8266:nodemcuv2 nodemcu
It should output something like:
esptool.py v3.0
Serial port /dev/ttyUSB0
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 4c:75:25:37:40:e5
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Auto-detected Flash size: 4MB
Compressed 289216 bytes to 210989...
Wrote 289216 bytes (210989 compressed) at 0x00000000 in 18.6 seconds (effective 124.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
in step 1, execute
arduino-cli config add board_manager.additional_urls http://arduino.esp8266.com/stable/package_esp8266com_index.json
command maybe more easy.like below shows :