Moderator: Mmiscool
memclear
dht.setup(22, D1)
textbox CurrTime
textbox CurrTemp
textbox CurrHum
button "Exit", [EndProg]
Timer 10000, [test]
wait
[test]
CurrTime = time("hour:min:sec")
CurrTemp = dht.temp()
CurrHum = dht.hum()
'serialprintln CurrTime & " " & CurrTemp & "C " & CurrHum & "%"
wait
[EndProg]
end
As I understand websockets the text boxes should update automatically as the variables change. The serialprintln confirms that the variables are being updated. Have I made another noobs mistake or is this another "gotcha!"?
I'm also getting occasional "0" readings for temp and humidity, I'm presuming this is a graceful recovery from a communication error with the DHT (I'm using a 10K pullup.)
Thanks for any help, regards,
Ian
10 seconds to me is a bit extreme for temperature ... I really don't think no one needs to know that much data about temps I've stated this usually even weather guys that deal with temps deal in intervals of 10 minutes now for indoor thermostats and such I could see a possible need for tighter numbers but ... 10 seconds is over kill of the hardware we are using I believe.
Have you attempted longer delays to see if it provides a remedy to the issue.
I am curious what is it that you have all attempted while I am short on a to the point answer on this one it may require some reading of the docs and the forums for me as well as yourself to come to a solution?
I personally would try delays between the fetching of the data to prevent any collisions... You may be able to check every 10 seconds but I assure you it is overkill I would stick to something like a minute if you are real data intense.
Where I buy my ESP8266 boards from... (Banggood)
The 10 second interval was purely for testing, so I wouldn't have to wait so long for the numbers to update. The DHT22 (AM2302) docs indicate updates up to 0.5 Hz should be OK.
As for what I've done, well it's taken me all morning to get this far, trying different code, debugging with serialprint, reflashing different units, reading the ESP2322Basic docs, searching the forums, googling other sources, and consulting data sheets.
I only post questions to this forum when I've spent considerable time and exhausted my own means of finding a solution. The main problem I have here is that the code partially works, and have concluded that there is some undocumented nuance that I can't find. Why is one text box updating and the other two not, when I have confirmed that all the variables are changing? I see similar issues crop up frequently on this forum, and a quick 30 second reply from an experienced user clarifies the situation.