You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 16, 2021. It is now read-only.
When I set my interrupt to detect both rising and falling edges using CHANGE, what ends up happening is that falling edges are ignored. I'm using a Nano 33 BLE.
My test setup consists of the code at the bottom, along with an LED connected to ledPin and a pushbutton connected to interruptPin. Note that interruptPin is pulled high.
What I expect to happen, given the CHANGE mode, is that LED should toggle when the button is both pressed (falling edge) and released (rising edge); however, it only toggles during button release.
(At first, I was having problems with my quadrature encoder code, but after some investigation it boiled down to the above issue).
The text was updated successfully, but these errors were encountered:
f-jiang
changed the title
attachInterrupt() only detects rising edges when mode is set to CHANGE
attachInterrupt() fails to detect falling edges when mode is set to CHANGE
Apr 26, 2020
I dug through the repo a bit, and it appears that every mode other than FALLING is being treated as rising edge detection (cores/arduino/Interrupts.cpp, line 49):
According to this old forum post, you can detect both rising and falling edges on an interrupt. How would I go about implementing and testing this change? Thanks!
When I set my interrupt to detect both rising and falling edges using
CHANGE
, what ends up happening is that falling edges are ignored. I'm using a Nano 33 BLE.My test setup consists of the code at the bottom, along with an LED connected to
ledPin
and a pushbutton connected tointerruptPin
. Note thatinterruptPin
is pulled high.What I expect to happen, given the
CHANGE
mode, is that LED should toggle when the button is both pressed (falling edge) and released (rising edge); however, it only toggles during button release.(At first, I was having problems with my quadrature encoder code, but after some investigation it boiled down to the above issue).
The text was updated successfully, but these errors were encountered: