I am having trouble coming up with two lines of code. The solution is simple, but I cannot figure out the proper syntax. Could someone please point out how to:
Turn on port 1 of the main relay IF port 4 of the main relay is off AND the time is NOT between midnight and 7:00am?
Secondly, how can I turn on port 7 of the main relay IF port 4 of the main relay is off OR the time is between 9:00pm and 11:00am?
How to set a conditional port status?
Re: How to set a conditional port status?
Try this:
Code: Select all
ReefAngel.Relay.Set(Port1, !ReefAngel.Relay.Status(Port4) && hour()>7);
ReefAngel.Relay.Set(Port7, !ReefAngel.Relay.Status(Port4) || hour()>=21 || hour()<11);
Roberto.
Re: How to set a conditional port status?
Awesome, thanks again. Testing it today. I learned a lot from those two lines.
Re: How to set a conditional port status?
Can this behavior also be used for the dosing pump port? For example, I do not want to dose vinegar if the metal halides are off. In other words, if my dosing pump is located at expansion relay 1, port 6, is it possible to only allow the dosing to occur if Main relay port 4 is on?
Re: How to set a conditional port status?
You would need to do like this:
Code: Select all
if (ReefAngel.Relay.Status(Port4))
ReefAngel.DosingPumpRepeat(Box1_Port6,0,60,5);
else
ReefAngel.Relay.Off(Box1_Port6)
Roberto.