I have some interrupt trigger testing code which doesn't work properly:
The code prints the pin for both falling and raising events, i.e. both when I connect the pin 12 to GND and when I disconnect it.
Code: Select all
from machine import Pin from time import sleep interrupt_pin = None def handle_interrupt(pin): global interrupt_pin interrupt_pin = pin pin = Pin(12, mode=Pin.IN, pull=Pin.PULL_UP) pin.irq(trigger=Pin.IRQ_FALLING, handler=handle_interrupt) while True: if interrupt_pin: print(interrupt_pin) interrupt_pin = None sleep(1)
Can someone check this small bit of code out, please?
BTW: I have tried using different pins without success.
REPL says I am using:
MicroPython v1.12 on 2019-12-20; ESP32 module with ESP32