Ive been reading the datasheet and i think i understand it but not gettingthe result im looking for.
all that is going to happen is an led toggle once a threshold has been breached
DDRB |= (1<<PINB5);
//Setting up ADC
ADMUX |= ((1<<REFS0) | (1<<REFS1) | (1<<ADLAR) | (1<<MUX0) | (1<<MUX1)); // set the ref voltage , set the left adjust , set the analog input pin
DIDR0 |= (1<<ADC3D); //disable digital input on that analog pin
ADCSRA |= ((1<<ADEN) | (1<<ADPS0) | (1<<ADPS1) | (1<<ADPS2) | (1<<ADSC)); //enable ADC , set the prescale , start conversion
if(ADCH >= 50 ) //read hight byte of adc register , since it was left adjusted
PORTB |= (1<<PINB5);
PORTB |= (0<<PINB5);
as far as wiring all i have is a pot with outter leads going to a common ground and 5v and middle lead going to analog input 3.
since reference voltage is set to internal 1.1v via the REFS0 bit & REFS1 , i dont need anything at the Aref pin , it does reccomend a cap at the aref pin either way and its there