Glowing LED Using MicroPython on ESP8266 Board

Glowing LED Using MicroPython on ESP8266 Board

This is a simple project in which I will glow an LED on esp8266 board  using MircoPython. To start is first of all you need to install Thonny  editor on your system.

Download Thonny

You can download it form the below link. https://thonny.org/

Therefore, download firmware for esp8266 which is used to flash Python’s program  onto the board.

Download ESP8266 Firmware

You can download it form the below link.

https://micropython.org/download/esp8266/

After downloading firmware, click on tools menu.

If you click on select menu, you will get option for browse and upload firmware.

ESP8266 NodeMCU

After uploading firmware  simply write help on >>> prompt.

If you see the the below message everything is ok, and you can write MicroPython programs.

ESP8266 NodeMCU

Create a file having name main.py and save on device it means that main.py will get uploaded on ESP8266.

Note- File name must be main.py for uploading on device.

Python Code

from machine import Pin
import time
ledobject= machine.Pin(2, Pin.OUT)
while True:
     ledobject.value(1)
     time.sleep(0.5)
     ledobject.value(0)
     time.sleep(0.5)

If the above code is saved on device LED will start blinking.

See in the video that built-in LED is blinking

See on Youtube

©Postnetwork-All rights reserved.