Random Wavemaker
-
Govertical19
- Posts: 27
- Joined: Wed Feb 15, 2012 6:52 am
Random Wavemaker
Hey all,
If I wanted port 3 and 4 to have random waves would this be the code I would use?
ReefAngel.WavemakerRandom1(Port3,15,60); // Turn Port3 on/off random cycles that lasts from 15 to 60 secs
ReefAngel.WavemakerRandom1(Port4,15,60); // Turn Port4 on/off random cycles that lasts from 15 to 60 secs
Or can the ports be put into one line of code?
Thanks in advance!
If I wanted port 3 and 4 to have random waves would this be the code I would use?
ReefAngel.WavemakerRandom1(Port3,15,60); // Turn Port3 on/off random cycles that lasts from 15 to 60 secs
ReefAngel.WavemakerRandom1(Port4,15,60); // Turn Port4 on/off random cycles that lasts from 15 to 60 secs
Or can the ports be put into one line of code?
Thanks in advance!
-
dmglakewood
- Posts: 26
- Joined: Thu Mar 01, 2012 1:31 pm
Re: Random Wavemaker
This is how I have mine setup
The above code will setup a timer to always run randomly between 15 and 60 seconds.
The above code will wait until the random number between 15 and 60 is reached and then it will run the code inside the if statement. This code will Toggle the powerhead on or off depending on it's current state. It will also setup another timer to run randomly between 15 and 6 0 seconds.
Code: Select all
void setup(){
ReefAngel.Timer[1].SetInterval(random(15,60));
ReefAngel.Timer[1].Start();
ReefAngel.Timer[2].SetInterval(random(15,60));
ReefAngel.Timer[2].Start();
}Code: Select all
void loop(){
//Left powerhead turn on
if(ReefAngel.Timer[1].IsTriggered()){
ReefAngel.Timer[1].SetInterval(random(15,60));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port3);
}
//Right powerhead turn on
if(ReefAngel.Timer[2].IsTriggered()){
ReefAngel.Timer[2].SetInterval(random(15,60));
ReefAngel.Timer[2].Start();
ReefAngel.Relay.Toggle(Port4);
}
}-
Sebyte
Re: Random Wavemaker
In the latest libraries the hard work is already done, the following code is all you need.
EDIT: I missed the second line should read ReefAngel.WavemakerRandom1(Port4,15,60); now corrected above.
Sebyte
Code: Select all
ReefAngel.WavemakerRandom(Port3,15,60);
ReefAngel.WavemakerRandom1(Port4,15,60);Sebyte
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: Random Wavemaker
I'd highly recommend you using Port 5 and 6 for wavemakers.
You will just have problems on the other ports.
You will just have problems on the other ports.
Roberto.
-
billybob
- Posts: 21
- Joined: Tue Apr 17, 2012 2:47 pm
- Location: Colorado
Re: Random Wavemaker
wait, I'm confused... I had been assuming that all the ports were identical, and we could mix/match and reassign them as needed.
is there something physically different about ports 5 and 6 from the rest of the ports?
is there something physically different about ports 5 and 6 from the rest of the ports?
-
Sebyte
Re: Random Wavemaker
Ports 5 & 6 are higher rated and have some extra components to allow for constant switching on and off. Which is what you need for wave makers.
-
binder
- Posts: 2865
- Joined: Fri Mar 18, 2011 6:20 pm
- Location: Illinois
- Contact:
Re: Random Wavemaker
Also, with using the WavemakerRandom functions, you cannot use them multiple times without potentially having problems.
So you would want to do
So you would want to do
Code: Select all
ReefAngel.WavemakerRandom(Port5, 15, 60);
ReefAngel.WavemakerRandom1(Port6, 15, 60);
-
abhi_123
- Posts: 216
- Joined: Tue Mar 20, 2012 8:34 am
-
binder
- Posts: 2865
- Joined: Fri Mar 18, 2011 6:20 pm
- Location: Illinois
- Contact:
Re: Random Wavemaker
These will go under the loop just like the standard wavemaker functions.abhi_123 wrote:Curt we have to put this code in loop or void or under custom code head?
-
abhi_123
- Posts: 216
- Joined: Tue Mar 20, 2012 8:34 am
Re: Random Wavemaker
Do we need to change it with the standard wave maker. if i want to synchronized them than what should i add.binder wrote:These will go under the loop just like the standard wavemaker functions.abhi_123 wrote:Curt we have to put this code in loop or void or under custom code head?
-
binder
- Posts: 2865
- Joined: Fri Mar 18, 2011 6:20 pm
- Location: Illinois
- Contact:
Re: Random Wavemaker
I don't follow.abhi_123 wrote:Do we need to change it with the standard wave maker. if i want to synchronized them than what should i add.
If you want to use it, change this line:
Code: Select all
ReefAngel.Wavemaker1(Port5);Code: Select all
ReefAngel.WavemakerRandom(Port5, 15, 60);What are you wanting to synchronize? The on/off of the wavemakers? So when wavemaker 1 is off, wavemaker 2 is on and vice versa? If you want this control, you should use:
Code: Select all
ReefAngel.WavemakerToggle(Port5, Port6, 60);Code: Select all
ReefAngel.WavemakerToggle(Port5, Port6, InternalMemory.WM1Timer_read());-
abhi_123
- Posts: 216
- Joined: Tue Mar 20, 2012 8:34 am
