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:
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:
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).