wavemaker nightmode

Related to the development libraries, released by Curt Binder
Post Reply
wijigong
Posts: 51
Joined: Sat Sep 17, 2011 5:03 am

wavemaker nightmode

Post by wijigong »

i think about what config i put in my future reef angel

in the day i use this fonction

ReefAngel.Timer[1].SetInterval(random(10,150));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port5);
ReefAngel.Relay.Toggle(Port6);

it is possible to have night mode for put the wavemaker on port 6 alway on and turn off the port 5

thank you
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: wavemaker nightmode

Post by binder »

Yes, it is possible. What time did you want "night mode" to kick in? When did you want it to run from?

What you can do is something like this:

Code: Select all

if ( (hour() >= 20) || (hour() <= 6) )  // from 8p - 6a
{
  ReefAngel.Relay.On(Port6);
  ReefAngel.Relay.Off(Port5);
}
else
{
  // during the day
  if ( ReefAngel.Timer[1].IsTriggered() )
  {
    ReefAngel.Timer[1].SetInterval(random(10,150));
    ReefAngel.Timer[1].Start();
    ReefAngel.Relay.Toggle(Port6);
    ReefAngel.Relay.Toggle(Port5);
  }
}
That should turn on port6 at 8p and keep it on until 6a. Then from 6a to 8p it will toggle the ports based on the Timers. There may be an improvement with the timer functionality. I'm just going from memory on what I think is the way to handle it. If it's not, somebody will catch it and update it for me. I'll also look again later tonight to confirm (if there's not been an update).

curt
Post Reply