import machine
import utime

led=machine.Pin(6,machine.Pin.OUT)
bt=machine.Pin(12,machine.Pin.IN, machine.Pin.PULL_DOWN)
val=0
etat=False

while True:

    if bt.value()==True:
        if val==1:
            etat=~etat
            val=0
            
        
    else:
        
        val=1
        
    led.value(etat)

BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT