Trying to control the humidity level in a growing environment and also provide air exchange.
I use a Uno, a rtc DS3231, a DHT22 probe and 2 relays, 1 for ventilation, 1 for humidifying said ventilation.
I want vent/hum to run whenever humidity drops below setRh, but I also want ventilation to run from second 0 to second 30, humidity to run from second 15 to second 30.
The part with the probe works, but not the timed cycles. Timed cycles work on their own, but not when combined with the DHT22 part.
Not sure how to program it or what kind of loop to use to cram it all in. Here's the code:
if (mySensor.getHumidity() < setRH)
digitalWrite(FogRelay, LOW), digitalWrite(FanRelay, LOW);
else if (mySensor.getHumidity() > setRH)
digitalWrite(FogRelay, HIGH), digitalWrite(FanRelay, HIGH);
else if ((now.second()>=0) & (now.second()<=15))
digitalWrite(FanRelay,LOW),digitalWrite(FogRelay,HIGH);
else if((now.second() >=15)&&(now.second() <=30))
digitalWrite(FanRelay,LOW), digitalWrite(FogRelay, LOW);
else
digitalWrite(FanRelay,LOW),(digitalWrite(FogRelay, LOW));
