I using the Arduino Micro. I have a problem reading ADC10 (PD7). My simple code for reading is like:
int ReadADC(int channel)
// Clear any previous read channel ADMUX &= ~((1 << MUX4) | (1 << MUX3) | (1 << MUX2) | (1 << MUX1) | (1 << MUX0)); // Clear all ADMUX bits // Define new ADC Channel to read (which analog pin: 0–5 on ATMega328p ADMUX |= (channel & 0x0F); // Start Conversion ADCSRA |= (1 << ADSC); // Wait until conversion is finished while (ADCSRA & (1 << ADSC)); // Return ADC value return ADCW;
Tried other ADCs, reading ADC4 - ADC7 works good.
Any hint is appreciated.