0 votes
by (150 points)
Wonder if anyone can help, I've implemented a push of locally attached DHT temp to Thingspeak as well as read from Thingspeak for an external sensor.

However in the main loop() the 2nd call is executed, but now the first never is.

I'm not really clear on what the && statement is checking for, but guessing its never True??

Any ideas?

void loop() {

  if (readyForWeatherUpdate && ui.getUiState()->frameState == FIXED) {
    updateData(&display);
  }

  if (readyForDHTUpdate && ui.getUiState()->frameState == FIXED)
    updateDHT();

I've placed the full code on Github here - https://github.com/anthonyjclarke/WeatherStation_DHT_Thingspeak

1 Answer

0 votes
by (3.6k points)
In the main loop I would just periodically call updateDHT(); based on :

if (millis() % 120000 == 0) updateDHT(); // Will update the DHT sensors readings every 2-minutes, or whatever

OR
 

void loop() {

  if (readyForWeatherUpdate && ui.getUiState()->frameState == FIXED) {
    updateData(&display);
    updateDHT();

}

Welcome to ThingPulse Q&A, where you can ask questions and receive answers from other members of the community.

https://thingpulse.com

...