import machine
import micropython.utime as utime
led_pin = machine.Pin(25, machine.Pin.OUT) # Set the pin number for the LED
while True:
led_pin.toggle() # Toggle the LED state (on/off)
utime.sleep(1) # Delay for 1 second
led_pin = machine.Pin(25, machine.Pin.OUT) # Set the pin number for the LED
button_pin = machine.Pin(
14, machine.Pin.IN, machine.Pin.PULL_DOWN
) # Set the pin number for the button
led_state = False # Variable to store the current state of the LED
while True:
if button_pin.value() == 1: # Check if the button is pressed
utime.sleep(0.1) # Debounce delay
if (
button_pin.value() == 1
): # Check if the button is still pressed after debounce delay
led_state = not led_state # Toggle the LED state
led_pin.value(led_state) # Set the LED state
utime.sleep(0.01) # Delay for a short period of time
pico:GP0
pico:GP1
pico:GND.1
pico:GP2
pico:GP3
pico:GP4
pico:GP5
pico:GND.2
pico:GP6
pico:GP7
pico:GP8
pico:GP9
pico:GND.3
pico:GP10
pico:GP11
pico:GP12
pico:GP13
pico:GND.4
pico:GP14
pico:GP15
pico:GP16
pico:GP17
pico:GND.5
pico:GP18
pico:GP19
pico:GP20
pico:GP21
pico:GND.6
pico:GP22
pico:RUN
pico:GP26
pico:GP27
pico:GND.7
pico:GP28
pico:ADC_VREF
pico:3V3
pico:3V3_EN
pico:GND.8
pico:VSYS
pico:VBUS
led1:A
led1:C
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
r1:1
r1:2