from machine import Pin
from time import sleep_ms
led=Pin(2,Pin.OUT)
key=Pin(0,Pin.IN,Pin.PULL_UP)
state=0
def on_falling():
global state
sleep_ms(10)
if(key.value()==0) #key를 누르면
state=not state
led.value(state)
key.irq(on_falling, Pin.IRQ_FALLING)