analogRead() sometimes take 2x longer *and* return diff data
Posted: Fri Sep 18, 2020 5:59 pm
Hello everyone,
Running esp8266-arduino v2.7.4 on Arduino IDE v1.8.13, using a "DOITING ESP-12F" esp8266 development board (board picture here: https://imgur.com/a/jr6ccLv).
I'm having a really weird issue: calling analogRead() sometimes take 2x longer, *AND* return a different value.
Here is my test circuit: https://imgur.com/a/AUg1KTX
Here is my test sketch: https://termbin.com/1hsy
Here is its **WEIRD** output: https://imgur.com/a/SHeXufj
Please notice that, at irregular (but not random) intervals, the analogRead() loop takes almost twice the time to execute, and returns a value about 6% lower.
Please also notice that these intervals are "irregular" but they are *not* random: if I reset the ESP8266, whenit runs the sketch again, these intervals repeats at exactly the same points and with the same values.
The sketch and circuit above are a much simplified version of a real circuit and sketch to read & massage data from an analog sensor.
Does anyone have any idea of what is happening?
Thanks in advance,
--
Durval.
Running esp8266-arduino v2.7.4 on Arduino IDE v1.8.13, using a "DOITING ESP-12F" esp8266 development board (board picture here: https://imgur.com/a/jr6ccLv).
I'm having a really weird issue: calling analogRead() sometimes take 2x longer, *AND* return a different value.
Here is my test circuit: https://imgur.com/a/AUg1KTX
Here is my test sketch: https://termbin.com/1hsy
Here is its **WEIRD** output: https://imgur.com/a/SHeXufj
Please notice that, at irregular (but not random) intervals, the analogRead() loop takes almost twice the time to execute, and returns a value about 6% lower.
Please also notice that these intervals are "irregular" but they are *not* random: if I reset the ESP8266, whenit runs the sketch again, these intervals repeats at exactly the same points and with the same values.
The sketch and circuit above are a much simplified version of a real circuit and sketch to read & massage data from an analog sensor.
Does anyone have any idea of what is happening?
Thanks in advance,
--
Durval.