Values passed to Relay.DelayedOn

Related to the development libraries, released by Curt Binder
Post Reply
jemw
Posts: 41
Joined: Sat Oct 08, 2011 9:21 am

Values passed to Relay.DelayedOn

Post 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
_____
Jim
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Values passed to Relay.DelayedOn

Post by rimai »

Can you explain a little more?
Roberto.
jemw
Posts: 41
Joined: Sat Oct 08, 2011 9:21 am

Re: Values passed to Relay.DelayedOn

Post 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?
_____
Jim
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Values passed to Relay.DelayedOn

Post 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?
Roberto.
alexwbush
Posts: 327
Joined: Tue Mar 22, 2011 12:45 am
Location: San Diego, CA

Re: Values passed to Relay.DelayedOn

Post by alexwbush »

couldn't you just enclose this in an if statement based on the hour?
jemw
Posts: 41
Joined: Sat Oct 08, 2011 9:21 am

Re: Values passed to Relay.DelayedOn

Post 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!
_____
Jim
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Values passed to Relay.DelayedOn

Post 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.
Roberto.
jemw
Posts: 41
Joined: Sat Oct 08, 2011 9:21 am

Re: Values passed to Relay.DelayedOn

Post 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!!
_____
Jim
jemw
Posts: 41
Joined: Sat Oct 08, 2011 9:21 am

Re: Values passed to Relay.DelayedOn

Post 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?
_____
Jim
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Values passed to Relay.DelayedOn

Post 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);
Roberto.
Post Reply