Control LEDs using NodeMCU and microPython - Part 1
This is an introductory guide to using microPython on NodeMCU dev kit board to control LEDs.
Last updated
This is an introductory guide to using microPython on NodeMCU dev kit board to control LEDs.
Last updated
What will we learn?
Preparing your coding environment - installing microPython.
Flashing microPython on your NodeMCU dev kit using Thonny IDE.
On a Windows computer, open the terminal (CMD) and run the following command:
Download the latest version of the microPython firmware for esp8266. You need to download the latest esp8266.bin file
It is very important to know on which port is your NodeMCU board is connected via the USB cable. The simplest way to do this is to use the Arduino IDE. The first you will need to do is connect your NodeMCU to your computer via the USB cable. Open the Arduino IDE software and click on Tools > Port > see port number
Erasing ESP8266 Flash memory
Before you can flash the esp8266 firmware on the NodeMCU, it is important to erase the memory. Hold down the Boot/Flash button on the NodeMCU, while holding it down run the following command
When the Erasing process start, you can release the Boot/Flash button.
Flashing microPython firmware on esp8266 using esptool.py
To flash the esp8266 firmware you need the port name on which your NodeMCU is connected.
Run the following command:
In our case, this is the command we will run:
This is what you will see after running the command:
At this point, you have successfully flashed the esp8266 firmware on your nodeMCU.
N.B. If you get an error while trying to flash the firmware, run the command again while holding the FLASH/BOOT button on the nodeMCU board.