Hopefully this is the right place to post this - I'm a noob for sure, and even newer to this forum. Tried NodeMCU forums but didn't seem to have the required permissions.
With the help of Reddit and Arduino forums, I was able to successfully program a controller for my indoor garden which would control both humidity and temperature. And it works perfectly!
For about 8-10 hours. Then it stops working and maintains its previous pin state, which results in one or two of the devices it controls (heater, AC, dehumidifier, humidifier) to run beyond my intended parameters. This could be catastrophic for my plants in a variety of ways so safe to say I'd like to prevent it.
ATTEMPTED SOLUTIONS
Reddit & Arduino both suggested that the issue could be my frequent time requests. After changing my requests from once per 2 seconds to once per 1 hour, the program behaved slightly strangely (abnormal dips in humidity & temp) and still failed after about the same period of time. So I'm going to try 5 minute requests, a happy medium - either way, that's not the issue. A friend who is familiar with coding but not Arduino specifically couldn't find any apparent issue.
My guess is that it's a memory issue. The program begins working perfectly again if I just unplug and replug the NodeMCU. Is there any way to achieve this artificially from a coding perspective? I don't need to store any information in the Node, I'm using SensorPush sensors to track room conditions.
CODE & PLEA FOR HELP
So I come to you all for help - this is now the last barrier between me and growing some plants!
I've attached the versions of the code both before (001 Seedling) and after (001.1 Seedling) fixing the time requests.
Arduino Forum discussion: https://forum.arduino.cc/index.php?topic=627118.0
Reddit discussion: https://www.reddit.com/r/arduino/commen ... h=1936c71d