Mega2560: Pin-change interrupt not firing

Pretty self-explanatory. I've boiled down the issue to this small piece of code:

volatile uint8_t light = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode( 22, INPUT_PULLUP );
  pinMode( A2, INPUT_PULLUP );
  pinMode( 10, OUTPUT );
  attachInterrupt( digitalPinToInterrupt(22), encoderChangeInterrupt, RISING );

void encoderChangeInterrupt() {
  light ^= 1;

void loop() {
  // put your main code here, to run repeatedly:
  if ( light ) {
    digitalWrite( 10, HIGH );
  else {
    digitalWrite( 10, LOW );

10 is hooked up to an LED, which I've confirmed will light if I set the initial value of the variable to 1. 22 and A2 are hooked up to an encoder - not particularly relevant to the problem though, and I've confirmed with a scope that it's making nice edges on pin 22 from 0 to 5V when turned, which should be plenty enough to trigger the interrupt.

The interrupt simply isn't firing though, and the light stays unlit. Any thoughts?

Pin 22 is not an interrupt pin: attachInterrupt() - Arduino Reference.

Using the PCINT interrupt is not supported by the default Arduino libraries. I suggest to use the EnableInterrupt for those.

Thanks for the catch! I did initially start on pin 21 but had other issues and moved it up one at some point and never noticed it wasn't supported. Back on pin 21, it seems to work as intended now.