Wie schnell ist analogRead() auf dem ESP8266?

English Deutsch

Ein analogRead()-Aufruf auf dem ESP8266 dauert etwa 90-100 Mikrosekunden.

Ich habe dies experimentell mit einem Wemos D1 Mini-Board, PlatformIO und diesem Code getestet:

analogread_benchmark.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);

Ausgabe:

analogread_output.txt
1000 analogRead() calls took [us]: 97168

Da 1000 analogRead()-Aufrufe (einschließlich etwas Overhead durch die Schleife) 97,168ms dauerten, dauert ein analogRead()-Aufruf etwa 97,168us (±0,02us).


Check out similar posts by category: Arduino, Electronics, ESP8266/ESP32, PlatformIO