#include <avr/io.h>
#include <avr/interrupt.h>
volatile uint8_t overflow_counter =0;
void init_timer2(){
TCCR2A |= (1<<CS20) | (1<< CS21) |(1<< CS22);
TIMSK2 |= (1<<TOIE2);
sei();
}
void setup() {
init_timer2();
DDRB |=(1<<PB0);
}
void loop() {
while(1);
}
ISR(TIMER2_OVF_vect){
overflow_counter++;
if(overflow_counter==122){
overflow_counter=0;
PORTB ^= (1<< PB0);
}
}