It should be really simple, but I'm clearly missing something here
void setup() {
ADMUX=0b01100000; //AVcc reference, ADLAR=1 (left adjusted), adc0 selected.
ADCSRA=0b11100000; //ADEN=1 (ADC enable), ADSC=1 (ADC start conversion), ADATE=1 (Auto
//trigger)}
void loop() {
if((ADCSRA&0b10000)==0b10000) { //Checks if the interrupt flag is high
Serial.println(ADCH, BIN);
ADCSRA=ADCSRA&0b10111111; //Clears the interrupt flag
}
}
The ADC seems to be running since it keeps raising the interrupt flag even after I reset it showing "ADC conversion complete", but the ADCH register is just filled with ones. Since ADLR=1 (left adjustment) it should be okay to just read the ADCH register, as the datasheet puts it: "Consequently, if the result is left adjusted and no more than 8-bit precision is required, it is sufficient to read ADCH.". Using analogRead(A0) works just fine so there are no hardware issues.