from machine import Pin 
from time import sleep
btn = Pin(6,Pin.IN)
led = Pin(21,Pin.OUT )
while True :
    print(btn.value ())
    sleep(0.2 )
    if btn.value()==1:
        led.value(1)
    else:
        led.value(0)    
        

Loading
pi-pico-w