SunFounder ESP32 Starter Kit
1. Open the 2.1_hello_led.py file located in the esp32-starter-kit-main\micropython\codes path, or
copy and paste the code into Thonny.
# Import the necessary libraries
import machine
import time
# Set up the LED on pin 26 as an output pin
led = machine.Pin(26, machine.Pin.OUT)
# Start an infinite loop
while True:
# Turn on the LED by setting its value to 1 (HIGH)
led.value(1)
# Wait for 1 second (1000 milliseconds) while the LED is on
time.sleep(1)
# Turn off the LED by setting its value to 0 (LOW)
led.value(0)
# Wait for 0.5 seconds (500 milliseconds) while the LED is off
time.sleep(0.5)
2. Connect the ESP32 WROOM 32E to your computer using a Micro USB cable.
3. Then click on the “MicroPython (ESP32).COMXX” interpreter in the bottom right corner.
3.7. 2.1 Hello, LED! 309