How PinChangeInterrupts differ from PinInterrupts
masterIt is crucial to understand the distinction between standard PinInterrupts and PinChangeInterrupts (PCINTs):
- PinInterrupts: Dedicated to a single pin. They can detect
RISING,FALLING, orCHANGEevents directly. - PinChangeInterrupts: Triggered for an entire port (a group of pins). Because the hardware only signals that a pin in the port changed, the library must save the port state and compare it to the previous state to determine which pin changed and whether it was a
RISINGorFALLINGedge.
Performance Note: Because of the detection overhead (comparing port states), PCINTs may be slightly slower (measured in microseconds) than standard PinInterrupts. Avoid using long function calls or Serial.print inside the Interrupt Service Routine (ISR).