#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>

//------------------------------------------------------------------------------
ISR (TIMER0_COMPA_vect)
{
	if (OCR0A == 69) OCR0A = 99; 	//Set 100 TOC0A1 = 1,6ms
	else OCR0A = 69; 				//Set 70 TOC0A2 = 1,12ms
}
//------------------------------------------------------------------------------
int main (void) {
	
	wdt_enable(WDTO_500MS);				//povolenie WDT 0,5sec
	 
	//TC0 - CTC mode
	TCCR0B |= (1<<CS02); 		//Set prescaler 256
	TCCR0A |= (1<<WGM01); 		//Set CTC mode
	TIMSK0 |= (1<<OCIE0A); 		//Enable Output Compare Interrupt
	TIFR0 |= (1<<OCF0A); 		//Clear OCFA flag
	TCCR0A |= (1<<COM0A0); 		//Toggle OC0A on Compare Match
	DDRD |= (1<<DDD6); 			//Enable OC0A (PD6) Output
	OCR0A = 69; 				//Set 70 fOC0A=446,42Hz

	sei();
	while(1) { 
		wdt_reset();
	}
}
//------------------------------------------------------------------------------

