The task is: after five clicks on OK, the built-in LED starts flashing with a frequency of 5Hz using an interrupt. After the eighth click on OK, the flashing (and glowing) should stop.Why is flashing not working
bool ledState = false;
volatile bool ledOn = true;
void setup(){
TCCR2A = 0;
TCCR2B = 0;
TIMSK2 = 0;
TCNT2 = 0;
OCR2A = 77;
TCCR2B |= (1 << CS22) | (1 << CS21) | (1 << CS20);
TIMSK2 |= (1 << OCIE2A);
pinMode(13, OUTPUT);
}
void loop(){
if(button5.buttonPressedCount >= 5 && button5.buttonPressedCount < 8){
ledState = true;
}
if(button5.buttonPressedCount > 7){
ledState = false;
}
}
ISR(TIMER2_COMPA_vect){
if(ledState){
digitalWrite(13, ledOn);
ledOn = !ledOn;
}
}
OCR2A = 77;
?OCR2A = 77;
?