Micro Python - Blink LED
Below is the code required to blink an LED in micro python.
Both wireless and none wireless examples are provided below.
Both wireless and none wireless examples are provided below.
Tested on a Raspberry Pi Pico W.
MICRO PYTHON CODE (Wireless):
import machine
import time
# Set the pin that the onboard LED is connected to
pin = machine.Pin("LED", machine.Pin.OUT)
# Create an infinite loop that toggles the state of the LED every second
while True:
pin.on()
time.sleep(0.5)
pin.off()
time.sleep(0.5)
MICRO PYTHON CODE (Not Wireless):
import machine
import time
# Set the pin that the onboard LED is connected to
pin = machine.Pin(25, machine.Pin.OUT)
# Create an infinite loop that toggles the state of the LED every second
while True:
pin.on()
time.sleep(0.5)
pin.off()
time.sleep(0.5)