You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
378 B
Python

from machine import Pin
# Enable input pin. We will put a button on this pin
pir = Pin(34, Pin.IN)
# Create handler
def handle_interrupt(pin):
print("You triggered the interrupt")
# attach interrupt to pin
pir.irq(trigger=Pin.IRQ_RISING, handler=handle_interrupt)
# You don't need a While loop here. If you leave it off you will get a REPL with your objects still set.