# alias "switch.py" Page 56+57 - Get started with MP on PP
# an external led is switched on via an external button, auto turn off

import machine, utime

led_external = machine.Pin(17, machine.Pin.OUT)
button = machine.Pin(16, machine.Pin.IN, machine.Pin.PULL_DOWN)

while True:
    if button.value() == 1:
        led_external.value(1)
        #print("You pressed the button!")
        utime.sleep(2)
    led_external.value(0) #turns the led off after 2 sek.
$abcdeabcde151015202530fghijfghij
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT