// void setup()
// {
// cli();
// TCCR0A = 0; // Init Timer1
// TCCR0B = 0; // Init Timer1
// TCCR0B |= B00000101; // Prescalar = 1024
// //Enable Overflow Interrupt Enable
// TIMSK0 |= B00000001; // Enable Timer Overflow Interrupt
// //Initialize Counter
// TCNT0=0;
// //Initialize our varriable
// //Port B[5] as output
// DDRB|=B00010000;
// //Enable Global Interrupts
// sei();
// }
// void loop(){
// }
// ISR(TIMER0_OVF_vect)
// {
// //This is the interrupt service routine for TIMER0 OVERFLOW Interrupt.
// //CPU automatically call this when TIMER0 overflows.
// //Increment our variable
// PORTB=~PORTB; //Invert the Value of PORTB
// }
void setup () {
pinMode(2, OUTPUT); // pin 2 is output
TCNT2 = 224; //load timer2 with 224
TCCR2B |= (1<<CS20); //no prescalar, normal mode
TIMSK2 = (1<<TOIE2); //enable overflow interrupt
sei();
}
void loop() {
}
ISR(TIMER2_OVF_vect){
TCNT2 = 224;
PORTD ^= (1<<PD2);
}