ESP8266 上 analogRead() 有多快?
ESP8266 上的 analogRead() 调用大约需要 90-100 微秒。
我使用 Wemos D1 Mini 板、PlatformIO 和此代码进行了实验测试:
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);输出:
analogread_output.txt
1000 analogRead() calls took [us]: 97168由于 1000 次 analogRead() 调用(包括循环的一些开销)花了 97.168ms,一次 analogRead() 调用大约需要 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