//Distributed under the GPL v 2.0
//by fenn 10/03/06
//simple test program blinks an LED on and off

#include <avr/io.h>

//for a delay of 1 second, n = about 23000
void delay(long n) 
{
	long a;
	for(a=0;a<n;a++)
	{
		//do nothing, fast!
	}
}


int main(void)
{    
	uint8_t toggle=0;
	long count=0;
	//hexadecimal 0xFF is 11111111 in binary
	DDRB=0xFF; //set port A to output
	DDRC=0xFF;
        while(1)
	{       
		PORTB^=_BV(PB5); //toggle the bit
		//PORTB|=_BV(PB5);//set the bit
		//PORTB&=~_BV(PB5);//clear the bit
		delay(80);
		//PORTB=0x00; //turn the led off
		//PORTB=0xFF; //turn the led on
		if(count >=2000){
			toggle=~toggle;
			count=0;
			PORTB^=_BV(PB4);
                        PORTB^=_BV(PB3);
		}
		count++;
	}
}
