import time
from machine import Pin
# button = Pin(0,Pin.IN)
# time.sleep(0.1) # Wait for USB to become ready
# print("Hello, Pi Pico!")
# # handler
# red_led = Pin(9,Pin.OUT)
# def action(button):
# red_led.on()
# print("LED turned on")
# time.sleep(1)
# red_led.off()
# button.irq(action, trigger=button.IRQ_FALLING)
button1 = Pin(0,Pin.IN)
button2 = Pin(28,Pin.IN)
# handler
red_led = Pin(9,Pin.OUT)
cur_time = 1.0
def blink():
global cur_time
for i in range(5):
red_led.on()
time.sleep(cur_time)
red_led.off()
time.sleep(cur_time)
def slow(button1):
global cur_time
cur_time += 0.1
print(cur_time)
blink()
def fast(button2):
global cur_time
cur_time -= 0.1
print(cur_time)
blink()
button1.irq(slow, trigger=button1.IRQ_FALLING)
button2.irq(fast, trigger=button2.IRQ_FALLING)