Blinking LED with Micropython 💥 💡
Documenting how I was able to set up and run Micropython on NodeMCU which is a esp8266 board and blink LED.
Installation
My setup
- Ubuntu 16.04
- Python 3.6.2
Software needed
esptool - $ sudo pip install esptool
rshell - $ sudo pip install rshell
micropython firmare for esp8266 - download latest version here
main.py in this repo. clone this repo to get it copy the code.
How to install
first erase flash using esptool with this command
esptool.py --port /dev/ttyUSB0 erase_flash
deploy the firmware
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --flash_size=detect 0 esp8266-20171101-v1.9.3.bin
Connecting to the board and running code
rshell -p /dev/ttyUSB0
> cp main.py /pyboard
On the nodemcu the onboard LED is on pin 2.
Now restart the board by pressing RST on the board or disconnect usb and reconnect.
LED should be blinking.
Note that on
method of a Pin might turn the LED off and off
might turn it on (or vice versa)