How to Arduino attachInterrupt() with both RISING and FALLING edge
You can use attachInterupt() with CHANGE to trigger on both RISING and FALLING flanks.
attachinterrupt_change_arduino.cpp
#define INTERRUPT_PIN 13 // Choose any pin with interrupt functionality here.
void myInterrupt() {
// TODO Your code goes here.
}
void setup() {
attachInterrupt(digitalPinToInterrupt(INTERRUPT_PIN), myInterrupt, CHANGE);
}If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow