from machine import Pin
import time
led = Pin("LED", Pin.OUT)
button = Pin(14, Pin.IN, Pin.PULL_UP)
last_press_time = 0
def button_pressed(pin):
global last_press_time
now = time.ticks_ms() 100ms
if time.ticks_diff(now, last_press_time) > 200:
led.toggle()
print("Valid button press")
last_press_time = now
button.irq(trigger=Pin.IRQ_FALLING, handler=button_pressed)
while True:
time.sleep(1)