Measuring Analog Signals - Espressif ESP8266 User Manual

Hide thumbs Also See for ESP8266:
Table of Contents

Advertisement

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

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP8266 and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF