Page 1 of 1

How do i code a port with timer function

Posted: Fri Aug 05, 2011 2:58 pm
by acabano
Please help!, does any body know how to add a timer function to a port, exact function with the Standard lights. is this possible with reef angel. can i do this with RAgen?


Thanks,

Re: How do i code a port with timer function

Posted: Fri Aug 05, 2011 3:15 pm
by rimai
MHLights() has a built-in delay timer

Re: How do i code a port with timer function

Posted: Fri Aug 05, 2011 6:33 pm
by binder
acabano wrote:Please help!, does any body know how to add a timer function to a port, exact function with the Standard lights. is this possible with reef angel. can i do this with RAgen?
You can use the MHLights function like Roberto said and also activate it with RAGen. RAGen only allows you to use 1 MHLights port but you can use it multiple times if you like however you must specify the on/off times manually though and you won't be able to update them via the menu system on the controller.

curt

Re: How do i code a port with timer function

Posted: Sat Aug 06, 2011 11:04 am
by acabano
I setup port1 and port4 with the standard light function would this work?

Re: How do i code a port with timer function

Posted: Sat Aug 06, 2011 11:53 am
by binder
acabano wrote:I setup port1 and port4 with the standard light function would this work?
Yeah, that would work. You will have to use the longer form of the StandardLight function and not the simple form because the simple form will have both ports (port1 & port4) operating with the same timer (unless that is what you wanted).

If you wanted them to operate differently, then you will have to hard code the on/off times for them. The usage for the standard light function is:

Code: Select all

ReefAngel.StandardLights(Port, OnHour, OnMinute, OffHour, OffMinute);
The hours are in 24 hour format. So 8pm would actually be 20. Here's an example:

Code: Select all

// Turn port 1 on at 9:30a and off at 4p
ReefAngel.StandardLights(Port1, 9, 30, 16, 0);
// Turn port 4 on at 1:15p and off at 9:30p
ReefAngel.StandardLights(Port4, 13, 15, 21, 30);
curt

Re: How do i code a port with timer function

Posted: Sat Aug 06, 2011 3:18 pm
by acabano
Curt, i use both port with same on/off time now, but i like the second option :)
i will try this and report the outcome.

Thanks for your support, it is greatly appreciated.

Re: How do i code a port with timer function

Posted: Sat Aug 06, 2011 9:32 pm
by binder
acabano wrote:Curt, i use both port with same on/off time now, but i like the second option :)
i will try this and report the outcome.

Thanks for your support, it is greatly appreciated.
Cool. The second option is how it "used" to be done prior to having the InternalMemory settings and the menu system. The only downside is that the values are hard coded so if you ever wanted to change them you would have to re-upload your code.

You're welcome for the help. Glad it works for you.

curt