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 );
interrupts();
}
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?