Complete the code to attach an interrupt that triggers on a rising edge.
attachInterrupt(digitalPinToInterrupt(2), handleInterrupt, [1]);
The RISING mode triggers the interrupt when the signal goes from LOW to HIGH.
Complete the code to attach an interrupt that triggers on a falling edge.
attachInterrupt(digitalPinToInterrupt(3), interruptHandler, [1]);
The FALLING mode triggers the interrupt when the signal goes from HIGH to LOW.
Fix the error in the interrupt mode to trigger on any change.
attachInterrupt(digitalPinToInterrupt(4), onChange, [1]);
The CHANGE mode triggers the interrupt on both rising and falling edges.
Fill both blanks to create arrays that map pins to interrupt modes for rising and falling triggers.
const int pins[] = {2, 3};
const int modes[] = { [1], [2] };Pin 2 uses RISING and pin 3 uses FALLING interrupt modes.
Fill all three blanks to create a map of pins to interrupt modes and attach interrupts accordingly.
const int pins[] = {5, 6, 7};
const int modes[] = { [1], [2], [3] };
for (int i = 0; i < 3; i++) {
attachInterrupt(digitalPinToInterrupt(pins[i]), interruptHandlers[i], modes[i]);
}Pin 5 uses LOW (though usually not recommended), pin 6 uses RISING, and pin 7 uses FALLING modes.