Page 1 of 1

WavemakerRandom function question

Posted: Fri Jan 03, 2014 8:40 pm
by saf1
Is there any sample code or examples of using the WavemakerRandom function that maybe includes a window when it runs rather than 24x7?

I found a couple examples earlier that I am using which work great with my two Koralia 425's. However, I'm looking at my tank and it may be a bit much :) It is a 29 gallon Bio Cube in which case I had one before that would randomly go on and off. The same logic worked with the new one but I was looking for something a bit longer in between like high and low tide somewhat, and then shutting both off when lights go out so only the return pump goes.

Just not sure how to but a bigger time around the code thus my question. Current code below which works.

Thanks.
-scott


ReefAngel.WavemakerRandom(Port5,3600,7200);
// Turn Port5 on/off random cycles that lasts from 25 to 60 secs
ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
// Turn Port6 on/off on opposite cycle as Port 5

Re: WavemakerRandom function question

Posted: Fri Jan 03, 2014 10:28 pm
by rimai
So, when is that you want to have them off?

Re: WavemakerRandom function question

Posted: Sat Jan 04, 2014 9:18 am
by saf1
rimai wrote:So, when is that you want to have them off?
I was thinking 8 pm to 8 am they would be off to give the tank some calmer flow or something like that. Or if it is even possible to put say a sleep or wait in there so the cycle rests every hour.

I just put it back to the original code I saw which was between 25 and 60 seconds to switch between the two. Everything appears to like the shorter durations better.

Side note. I just noticed the new menu. It looks nice. Thank you.

Re: WavemakerRandom function question

Posted: Sat Jan 04, 2014 10:29 am
by rimai
You can use like this:

Code: Select all

if (hour()>=20 || hour()<8)
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
}
It will turn the ports off on hour >= 20 or hour < 8

Re: WavemakerRandom function question

Posted: Sun Jan 05, 2014 9:23 am
by saf1
Hi Roberto,

That seems easy enough. Is there a set place to put that bit of code? I placed it under the void loop. Didn't seem like it did much but I think I get the idea although it is in the wrong block/location.

-scottf

void loop()
{
// ReefAngel.WavemakerRandom( Port5,60,100 );
// ReefAngel.WavemakerRandom( Port6,120,300 );
ReefAngel.PWM.SetDaylight( PWMParabola(11,0,19,0,0,90,0) );
ReefAngel.PWM.SetActinic( PWMParabola(8,0,21,0,0,80,0) );

////// Place your custom code below here

// This will turn off both relays at a set time

if (hour()>=20 || hour()<9)
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
}


ReefAngel.WavemakerRandom(Port5,25,60);
// Turn Port5 on/off random cycles that lasts from 25 to 60 secs
ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
// Turn Port6 on/off on opposite cycle as Port 5

Re: WavemakerRandom function question

Posted: Sun Jan 05, 2014 9:39 am
by lnevo
The part that turns the wavemakers off needs to be last..

Re: WavemakerRandom function question

Posted: Sun Jan 05, 2014 9:40 am
by lnevo
void loop()
{
// ReefAngel.WavemakerRandom( Port5,60,100 );
// ReefAngel.WavemakerRandom( Port6,120,300 );
ReefAngel.PWM.SetDaylight( PWMParabola(11,0,19,0,0,90,0) );
ReefAngel.PWM.SetActinic( PWMParabola(8,0,21,0,0,80,0) );

////// Place your custom code below here

ReefAngel.WavemakerRandom(Port5,25,60);
// Turn Port5 on/off random cycles that lasts from 25 to 60 secs
ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
// Turn Port6 on/off on opposite cycle as Port 5
// This will turn off both relays at a set time

if (hour()>=20 || hour()<9)
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
}

Re: WavemakerRandom function question

Posted: Sun Jan 05, 2014 9:31 pm
by saf1
Thanks Lnevo and Rimai. That worked perfectly.

Simple too!

Re: WavemakerRandom function question

Posted: Mon Jan 06, 2014 11:08 am
by binder
saf1 wrote:Thanks Lnevo and Rimai. That worked perfectly.

Simple too!
you can ignore my post in the other topic then. it's basically the same thing :-)
glad you got it working

Sent from my Nexus 7

Re: WavemakerRandom function question

Posted: Thu Jan 09, 2014 11:54 am
by saf1
binder wrote:
saf1 wrote:Thanks Lnevo and Rimai. That worked perfectly.

Simple too!
you can ignore my post in the other topic then. it's basically the same thing :-)
glad you got it working

Sent from my Nexus 7
Thanks Binder. I forgot I actually posted there and made a new one. Bad on my part, I apologize. In hind sight the solution was easy and works great. I'm not sure if the fish are happy but the corals sure do love the back and forth change (although my golden leather and Kenya trees seem to be touching and the leather doesn't like it much).