ADC channel selection
Posted: Sun Jul 04, 2021 9:11 pm
I´ve been struggling to change the ADC channel on an ESP32-C3.
I get an ADC value, but only from GPIO0 no matter what i set in analogread() it always reads GPIO0.
I tried two boards to rule out physical damage. Any ideas what can be wrong?
Is there somthing whong in my code? Tried the minimal code to isolate the problem.
Did try without the pinMode without any success.
I get an ADC value, but only from GPIO0 no matter what i set in analogread() it always reads GPIO0.
I tried two boards to rule out physical damage. Any ideas what can be wrong?
Is there somthing whong in my code? Tried the minimal code to isolate the problem.
Code: Select all
void setup() {
Serial.begin(115200);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
}
void loop() {
Serial.print("Batt=");
delay(5);
Serial.print(analogRead(0));
delay(5);
Serial.print(" Solar=");
delay(5);
Serial.println(analogRead(1));
delay(185);
}