April 11, 2015 at 4:36 am #12782
As i come to know there is problem in your "uint16_t ReadADC(uint8_t ch)" function
" while(ADCSRA & (1<<ADSC));" this statement is wrong. As adsc is to start conversion.
You need to write-
while(!(ADCSRA & (1<<ADIF))); // waiting for ADIF, conversion complete
ADCSRA|=(1<<ADIF); // clearing of ADIF, it is done by writing 1 to it
After this modification your code will properly run.
Any doubt, feel free to ask