void init(void){
for(int x=0;x<50;x++){_delay_ms(100);}
		

DDRA=0x00;//Configure all pins on port A as input for ADC
DDRB= 0xFF;//Configure all pins on port B as outputs
DDRC=0xFF;//These are outputs for the decoder
DDRD = 0b11111110;//Set Port D direction

usart_init(USART_BAUDRATE(9600,16));//Configure the usart for 9600 baud on a 16 mHz xtal

ADCSRA|=(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);//Set the ADC to max resolution and slowest speed=16Mhz/128
ADMUX = 0; //Initial channel selection
ADCSRA |= (1<<ADEN); //Enable the ADC
ADMUX|=(1<<REFS0);//Use AVCC as the Vref





  TCCR2 = _BV(WGM20)     // timer 2 fast PWM
        | _BV(WGM21)     // ditto
        | _BV(COM21)     // clear OC2 on compare match, set OC2 at TOP
        | _BV(CS21);     // 1/8 prescale
	OCR2=200;			 // this sets the third pwm

TCCR1A = _BV(WGM10)      // 8 bit fast PWM, see WGM12 below
         | _BV(COM1A1)   // set OC1A/B on compare match, clear them at top
         | _BV(COM1B1);
TCCR1B = _BV(CS11)       // 1/8 prescale
         | _BV(WGM12) ;  // fast PWM  


for(int x=0;x<200;x++){//Flicker the LED for debugging

	PORTB^=0xFF;
	_delay_ms(200);

}

}
