How do i code a port with timer function

Do you have a question on how to do something.
Ask in here.
Post Reply
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

How do i code a port with timer function

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

Re: How do i code a port with timer function

Post by rimai »

MHLights() has a built-in delay timer
Roberto.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How do i code a port with timer function

Post 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
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: How do i code a port with timer function

Post by acabano »

I setup port1 and port4 with the standard light function would this work?
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How do i code a port with timer function

Post 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
acabano
Posts: 49
Joined: Thu Jul 21, 2011 6:09 pm

Re: How do i code a port with timer function

Post 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.
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: How do i code a port with timer function

Post 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
Post Reply