Page 1 of 1
Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 7:43 am
by jemw
In addition to setting a 1 minute delay to:
ReefAngel.Relay.DelayedOn(Port1, 1);
I would also like to set a schedule for on/off times.
Is this possible? What are the values the function accepts? OR Where can I find them in the code?
Thanks!!
Jim
Re: Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 9:06 am
by rimai
Can you explain a little more?
Re: Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 10:21 am
by jemw
rimai wrote:Can you explain a little more?
The ReefAngel.Relay.DelayedOn function accepts the port as the first argument and the time of the delay as the second argument. Will it accept additional arguments such as time on/time off?
Re: Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 10:33 am
by rimai
Oh, no it won't.
So, you would like have the port work on time schedule, but if it is stopped by feeding/water change mode or power cycle, it should delay start, is that it?
Re: Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 4:05 pm
by alexwbush
couldn't you just enclose this in an if statement based on the hour?
Re: Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 4:35 pm
by jemw
rimai wrote:Oh, no it won't.
So, you would like have the port work on time schedule, but if it is stopped by feeding/water change mode or power cycle, it should delay start, is that it?
Correct!
Re: Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 5:15 pm
by rimai
One easy way to do this would be leaving the function the way it is and use another one to turn it off when it is within the timeframe for turn off.
So, use this:
Code: Select all
ReefAngel.Relay.DelayedOn(Port1, 1);
if (NumMins(hour(),minute()) <= NumMins(8,0)) ReefAngel.Relay.Off(Port1) // Turn off Port1 before 8am
if (NumMins(hour(),minute()) >= NumMins(22,0)) ReefAngel.Relay.Off(Port1) // Turn off Port1 after 10pm
Try this out and see if it works for you.
Re: Values passed to Relay.DelayedOn
Posted: Thu Nov 10, 2011 6:01 pm
by jemw
rimai wrote:One easy way to do this would be leaving the function the way it is and use another one to turn it off when it is within the timeframe for turn off.
So, use this:
Code: Select all
ReefAngel.Relay.DelayedOn(Port1, 1);
if (NumMins(hour(),minute()) <= NumMins(8,0)) ReefAngel.Relay.Off(Port1) // Turn off Port1 before 8am
if (NumMins(hour(),minute()) >= NumMins(22,0)) ReefAngel.Relay.Off(Port1) // Turn off Port1 after 10pm
Try this out and see if it works for you.
Thanks!!
Re: Values passed to Relay.DelayedOn
Posted: Fri Nov 11, 2011 6:27 am
by jemw
rimai wrote:One easy way to do this would be leaving the function the way it is and use another one to turn it off when it is within the timeframe for turn off.
So, use this:
Code: Select all
ReefAngel.Relay.DelayedOn(Port1, 1);
if (NumMins(hour(),minute()) <= NumMins(8,0)) ReefAngel.Relay.Off(Port1) // Turn off Port1 before 8am
if (NumMins(hour(),minute()) >= NumMins(22,0)) ReefAngel.Relay.Off(Port1) // Turn off Port1 after 10pm
Try this out and see if it works for you.
Don't we need code to turn it on?
Re: Values passed to Relay.DelayedOn
Posted: Fri Nov 11, 2011 9:16 am
by rimai
Hum.. you are right, but that would also disable the DelayedOn() function.
So I guess we scratch this code.
Try this one instead:
Code: Select all
if (NumMins(hour(),minute()) >= NumMins(8,0) && NumMins(hour(),minute()) <= NumMins(22,0)) ReefAngel.Relay.DelayedOn(Port1, 1); else ReefAngel.Relay.Off(Port1);