It’s this simple:
—
pinMode(5,INPUT);
PCMSK2 |= (1<
--
Catch the interrupts (default when signal goes up OR down)
ISR(PCINT2_vect)
{
// code here..
}
PCINT?_vect vectors are always used for Pin Change Interrupt Request Interrupts (see http://www.nongnu.org/avr-libc/user-manual/group__avr__interrupts.html)
--
Remember:
PCINT0..7 are asscociated with the 8 pins in PORTA and trigger the PCINT0_vect interrupt
PCINT8..15 are asscociated with the 8 pins in PORTB and trigger the PCINT1_vect interrupt
PCINT16..23 are asscociated with the 8 pins in PORTC and trigger the PCINT2_vect interrupt
PCINT24..31 are asscociated with the 8 pins in PORTD and trigger the PCINT3_vect interrupt