LoBo Forums

Full Version: irq not work
You're currently viewing a stripped down version of our content. View the full version with proper formatting.


The interruption/callback does not work for me...

def callback(p):
    print('pin change', p)

p0 = machine.Pin(0, machine.Pin.IN, machine.Pin.PULL_UP, handler=callback('p0'), trigger=machine.Pin.IRQ_RISING | machine.Pin.IRQ_FALLING)

During start, the function starts once "callback()"

The Prog button (Pin 0) does not respond to
callback function.

You need to use handler=callback without the parenthesis. With the parenthesis you’re setting handler to the return value of calling the callback.