import time
time.sleep(0.1) # Wait for USB to become ready
from machine import Pin, Timer
p0=Pin(1,Pin.OUT)
p1=Pin(2,Pin.OUT)
p2=Pin(3,Pin.OUT)
p3=Pin(4,Pin.OUT)
p4=Pin(5,Pin.OUT)
p5=Pin(6,Pin.OUT)
p6=Pin(7,Pin.OUT)
p7=Pin(8,Pin.OUT)
button_1=Pin(9,Pin.IN,Pin.PULL_DOWN)
button_2=Pin(10,Pin.IN,Pin.PULL_DOWN)
debounce_timer = Timer()
debouncing = False
def handler(pin):
global debouncing
if not debouncing:
debouncing = True
debounce_timer.init(period = 50, mode = Timer.ONE_SHOT, callback = lambda t: end_debounce())
def end_debounce():
global debouncing
debouncing = False
button_1.irq(trigger=Pin.IRQ_FALLING, handler = handler)
button_2.irq(trigger=Pin.IRQ_FALLING, handler = handler)
while True:
pass