Page 1 of 1
How to set a conditional port status?
Posted: Thu Jul 04, 2013 7:16 am
by btorrenga
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?
Re: How to set a conditional port status?
Posted: Thu Jul 04, 2013 8:50 am
by rimai
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);
Re: How to set a conditional port status?
Posted: Fri Jul 05, 2013 2:14 pm
by btorrenga
Awesome, thanks again. Testing it today. I learned a lot from those two lines.
Re: How to set a conditional port status?
Posted: Tue Jul 16, 2013 9:34 pm
by btorrenga
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?
Posted: Tue Jul 16, 2013 9:56 pm
by rimai
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)