from machine import Pin
import time
led = Pin(4, Pin.OUT)
switch = Pin(0, Pin.IN, Pin.PULL_DOWN)
def appuyer_sur_switch():
while True:
if switch.value() == 0:
led.on()
else:
led.off()
time.sleep(0.1)
appuyer_sur_switch()