How fast is analogRead() on the ESP8266?
An analogRead()
call on the ESP8266 takes about 90-100 microseconds.
I tested this experimentally using a Wemos D1 Mini board, PlatformIO and this code:
example.cpp
uint32_t t0 = micros();
for (size_t i = 0; i < 1000; i++)
{
analogRead(A0);
}
uint32_t t1 = micros();
Serial.print("1000 analogRead() calls took [us]: ");
Serial.println(t1-t0);
Output:
example.txt
1000 analogRead() calls took [us]: 97168
Since 1000 analogRead()
calls (including some overhead from the loop) took 97.168ms
, one analogRead()
call takes about 97.168us
(+-0.02us).
Check out similar posts by category:
Arduino, Electronics, ESP8266/ESP32, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow