How to Arduino attachInterrupt() with both RISING and FALLING edge

You can use attachInterupt() with CHANGE to trigger on both RISING and FALLING flanks.

#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);
}