ESP32 Analog Input – analogRead

AnalogRead does indeed work on the ESP32.  Many sites and posts that claim that the Analog to Digital converter of the ESP32 doesn’t work.  I have tested analogRead using the code below and it works as expected.  The code below compiles and downloads to my ESP32 Development board and produces correct results.  The input pin is the seventh pin from the top on the left hand side of the ESP32 Development Board.

#define RLED 16
#define InPin 33

int x ;

void setup() {
   pinMode(RLED, OUTPUT);

void loop()
   digitalWrite(RLED, LOW);
   x = analogRead( InPin );
   Serial.println( x );
   digitalWrite(RLED, HIGH);

Have fun!

  • maneco

    HI! i’m trying to make work the analog example from the downloaded codes, is analogwrite implemented? thanks!