Skip to content

Can't get interrupts to work #276

Answered by grandaspanna
gizmo71 asked this question in Q&A
Discussion options

You must be logged in to vote

I've definitely had interrupts working, both with the Arduino attachInterrupt() and the native gpio_set_irq_enabled_with_callback(). I settled on the latter so I could have one interrupt handler that worked out which pin triggered the interrupt.

However, that doesn't explain your issue. Can't see an obvious problem, but in my code, I simply use the GPIO number in the digitalPinToInterrupt macro. Otherwise, I'd start by putting some LED toggling in the interrupt handler, to avoid any issues with variables. That way, you can see if the interrupt is getting called at all.

Having said all of that, I tried your code on my Pico and it works (core: 1.9.1)

Replies: 1 comment 8 replies

Comment options

You must be logged in to vote
8 replies
@grandaspanna
Comment options

@gizmo71
Comment options

@grandaspanna
Comment options

@earlephilhower
Comment options

@gizmo71
Comment options

Answer selected by earlephilhower
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants