F. Measuring analog signals
So far we can read and write the digital states HIGHand LOW, but what if we want to deal
with analog signals? The ESP has one Analog To Digital Converter (ADC) which can be used
to measure voltage in the range 0 - 1V. To do that use the following command:
unsigned value = analogRead(A0);
You can also use the ADC to measure the input voltage without any additional wiring. You
have to instruct the processor that you want to measure the supply voltage rather than the
value on A0 with a special command outside the
example:
ADC_MODE(ADC_VCC);
void setup()
{ Serial.begin(115200);
}
void loop()
{ Serial.println(ESP.getVcc());
delay(500);
}
setup()
and
loop()
method. Here is an
Need help?
Do you have a question about the ESP8266 and is the answer not in the manual?
Questions and answers