I am using an Arduino Mega to build a relative humidity setup. I am doing this by turning solenoid valves on and off using relays connected to the Arduino. I have no trouble with switching the relays on and off. I also have my program displaying the humidity and temperature using a DHT 22 humidity sensor using the serial monitor. I have written a small program to test this.
What I am having trouble with is that the data comes in for a few hours, but after that the system just stops displaying any data (I am using Serial.println() to display data in the serial monitor). Essentially, the serial monitor just freezes and the LCD display I have connected also freezes displaying the same humidity and temperature levels. I cant seem to figure out what is causing this problem. I am thinking that for some reason, the system just 'gets stuck' in that relative humidity/ temperature setting so my solenoid valves stop responding to the different if else conditions after some time.
I would greatly appreciate any help with this matter!
Your code is likely good so I focus on the hardware.
I would like You to post real schematics, not any children's Fritzings. Power source, voltage, pin names etc....
A photo of the setup might tell something.
Got it. I was just trying to make sure I was not losing any serial connection between the Arduino and my connected computer, but I believe the problem just seems to be my code where there is no condition while the hum is between 88 and 88.99.
Thank you for the response. But as Coding_Badly pointed out, there seems to be an undefined state when the hum value reads between 88.0 and 88.9... I will fix this and see how it works.