WebServer - analogRead conflict?

A project log for ForEx display

A stylish desktop widget shows you the actual foreign exchange rates and the time of different locations

StefanStefan 05/01/2016 at 10:540 Comments
When programming this little gadget everything worked well. Then I removed all the debugging stuff did a quick check and uploaded it - fine. Since that it runs on my desk but as I required Singapore Dollars the web interface didn't responded last week. Restarting didn't helped a lot - no answer. Analyzing that matter isn't a big deal. There are only 4 activities in the main loop: 1. Refresh the entire screen every minute. 2. Request the information from the API's and NTP server every 24h. 3. Check whether there is a request from internet port 80 (which obviously didn't work). 4. Measure the brightness and adjust the current for the display back light. As 1&2 are executed only rarely and 3 is the matter to fix, it needs to be cased by 4. And indeed commenting out the brightness control the web interface worked perfectly. By further activate and deactivate elements of the brightness control sequence it became obvious that the analogRead function caused the conflict. Without the web server worked, with no response. I was able to solve the problem by adding a delay() statement after the analogRead statement. Playing a round with the length didn't give more insights. Pretty often the time delay(1) was already sufficient and I could place it before or after the analogRead. With delay(100) I had absolutely stable results. As the ESP8266 Arduino does quite some activities I guess this is based on this but finally haven't an idea why it's really the case. As the delay statement in this configuration (ESP8266 Arduino ) execute some other stuff in the background I tried the yield() function as well (as this should do the same) but without any impact. Even I'm not sure about the effective problem it's solved now and uploaded to GitHub