Can anybody tell me why my interrupt isn't working? I am very new to coding and am clearly missing something here because when running this code, the pins do not get interrupted but when testing the doEncoderA and doEncoderB, it counts the pulses. Any help would be greatly appreciated, thank you
volatile long int PulseCount;
int encoderA=2;
int encoderB=3;
//if the value at channel A is not equal to the value at B
// that is a change in the number of ticks
if(digitalRead(encoderA)!= digitalRead(encoderB))
(
PulseCount++
);
}
void doEncoderB()
{ //if the value at A does not equal the value at B
//Ticks will increase
if (digitalRead(encoderA)==digitalRead(encoderB))
(
PulseCount++
);
else
(
PulseCount--
);
//print current number of ticks in serial monitor
Serial.print("PulseCount: ");
Serial.println(PulseCount);
I really don't know if the parentheses after the If/Else statements are legal, but it might be worth trying this format to see if it makes any difference: