import micropython
from machine import Pin
p1 = Pin(1, Pin.IN,Pin.PULL_UP)
p2 = Pin(2, Pin.IN,Pin.PULL_UP)
p3 = Pin(4, Pin.IN,Pin.PULL_UP)
RLED=Pin(11,Pin.OUT)
GLED=Pin(10,Pin.OUT)
BLED=Pin(9,Pin.OUT)
micropython.alloc_emergency_exception_buf(100)
#中斷處理程式範例
def callback(p):
print('pin change', p)
while True:
p1.irq(trigger=Pin.IRQ_FALLING , handler=callback)
p2.irq(trigger=Pin.IRQ_RISING |Pin.IRQ_FALLING , handler=callback)
if p3.value()==0:
RLED.value(0)