WavemakerRandom function question

Basic / Standard Reef Angel hardware
Post Reply
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

WavemakerRandom function question

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

Re: WavemakerRandom function question

Post by rimai »

So, when is that you want to have them off?
Roberto.
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: WavemakerRandom function question

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

Re: WavemakerRandom function question

Post 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
Roberto.
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: WavemakerRandom function question

Post 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
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: WavemakerRandom function question

Post by lnevo »

The part that turns the wavemakers off needs to be last..
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: WavemakerRandom function question

Post 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);
}
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: WavemakerRandom function question

Post by saf1 »

Thanks Lnevo and Rimai. That worked perfectly.

Simple too!
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: WavemakerRandom function question

Post 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
saf1
Posts: 111
Joined: Thu Jun 28, 2012 1:46 pm

Re: WavemakerRandom function question

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