MicroPython ESP32 blink example
This MicroPython code blinks GPIO2
which is connected to the LED on most ESP32 boards.
import machine
import time
led = machine.Pin(2, machine.Pin.OUT)
while True:
led.value(1)
time.sleep(1)
led.value(0)
time.sleep(1)
Don’t know how to upload the file to MicroPython so it is automatically run on boot?
- To flash over USB, see How to upload files to MicroPython over USB/serial
- To flash over the network (with WebREPL already enabled), see How to upload files to MicroPython using WebREPL using webrepl_cli.py