Run MicroPython on ESP8266
1. Run the script directly
# Simple script:
print("Hello MicroPython")2. Use the .py file to run the script
from machine import Pin
import time
# GPIO LED IO2
def blink():
led = machine.Pin(2, machine.Pin.OUT) # Pin 2 ,Output mode
while(True): # loop
led.on() # light on LED
time.sleep(1) # delay 1s
led.off() # light off LED
time.sleep(1) # delay 1s
if __name__ == "__main__":
blink()
3. Upload the .py file to the ESP8266



4. Write a script to let robot perform actions sequentially

5. Power on and run automatically
Last updated
Was this helpful?