You are setting up interrupts for timer2 compare, but not defining the interrupt service routine so it's probably jumping off into unknown territory. Once you define this function, your code works.
ISR (TIMER2_COMPA_vect)
{
// you code here
}
You are setting up interrupts for timer2 compare, but not defining the interrupt service routine so it's probably jumping off into unknown territory. Once you define this function, your code works.
ISR (TIMER2_COMPA_vect)
{
// you code here
}