安装固件https://micropython.org/download/RPI_PICO2/
from machine import Pin # Import the Pin class from the machine module from time import sleep # Import the sleep function from the time module # Initialize GPIO25 as an output pin, which controls the USER LED led = Pin(25, Pin.OUT) # Turn off the LED initially led.value(1) # led.on() -> high level -> light off sleep(0.5) # Wait for 0.5 seconds # Turn on the LED led.value(0) # led.off() -> low level -> light on sleep(0.5) # Wait for 0.5 seconds # Enter an infinite loop while True: # Toggle the LED state (on to off or off to on) led.toggle() # Print the current state of the LED print(f"LED {'ON' if led.value() == 0 else 'OFF'}") sleep(0.5) # Wait for 0.5 seconds before the next toggle