So you're a Noob? Post your questions here until you graduate! Don't be shy.

User avatar
By Lars Bo Wassini
#70567 Update:

After I started this thread, I searched the internet a little further. My problem seems to be that the GPIO on ESP8266 does not actually have analog input. I need to use the ADC pin, and this is not present on the ESP8266-01 I was playing with.
I'll try using a "bigger" (07..12) version, where the ADC pin is exposed.
User avatar
By Lars Bo Wassini
#70666 I found a solution!
This is also working for ESP8266-01

Code: Select allADC_MODE(ADC_VCC);      // voltage sensor
int vcc;

void setup() {
...
}

void loop() {
   vcc = ESP.getVcc();

    double dvcc = (float)vcc / 1000;
    Serial.println("Voltage: " + String(dvcc,3) + "V");
}