Hello All,
Just got a RA and am tinkering with it a bit. So far it is a very neat device, and has done what I have needed it to. The RAgen and the tutorials are a very good starting point to get what you need from the controller.
One question I have come across is how best to add additional wavemakers to the controller. As of right now there are only 2 and I would like to add a couple more. I don't see any options in the RAgen, so would assume that I would have to add some lines of code into the libraries. Just wondering how best to approach this problem.
Thanks,
Tim
how to add additional wavemakers
Re: how to add additional wavemakers
Thanks. Glad it's helpful for a good starting point. That's the goal of it....to provide a good starting point that will help with most of the basics. The "extra stuff" requires a little more work.tngo wrote: Just got a RA and am tinkering with it a bit. So far it is a very neat device, and has done what I have needed it to. The RAgen and the tutorials are a very good starting point to get what you need from the controller.
First off, I will say that it is not recommended to make changes to the libraries. This makes it harder when/if you upgrade the libraries to newer versions. You have to re-add in all of your changes and if there have been any major changes to the libraries it can take a little while to get things back running properly again. We have run into these situations before where people made changes and then upgraded and things didn't work right. I spent a few hours trying to help somebody only to find out that they had made changes and forgot to mention it.tngo wrote: One question I have come across is how best to add additional wavemakers to the controller. As of right now there are only 2 and I would like to add a couple more. I don't see any options in the RAgen, so would assume that I would have to add some lines of code into the libraries. Just wondering how best to approach this problem.
Now that has been said, in order to accomplish what you are wanting to do with additional wavemakers on their own intervals, modifying the libraries is necessary at this current time. The drawback is you have to manually code the intervals for the additional wavemakers and cannot use the setup menu on the controller to change the intervals.
I'm going to give an example based off of adding 2 more wavemakers to the setup. I'm going to assume wavemakers 3 & 4 are attached to ports 6 and 7 (wavemaker 1 & 2 are on ports 4 & 5 respectively by default unless they are changed).
The first change we must make is to the ReefAngel.h file. We need to add in 2 additional timers to the timer group. To do this, you need to open up the ReefAngel.h file in the libraries/ReefAngel/ folder. Look for this line:
Code: Select all
ReefAngel_TimerClass Timer[6];
Code: Select all
ReefAngel_TimerClass Timer[8]; // Added 2 additional timers
Now, we need to add in the code to your PDE file to activate the 2 new wavemakers.
In the setup() section of your PDE file, you need to add this:
Code: Select all
void setup()
{
// existing code goes here
// ...
// Set the intervals for the 2 additional wavemakers, value can be from 0 - 21600 seconds
ReefAngel.Timer[6].SetInterval(1800); // Wavemaker 3 with 1800s interval
ReefAngel.Timer[6].Start(); // Start Wavemaker 3 timer
ReefAngel.Relay.On(Port6); // Turn on Wavemaker 3
ReefAngel.Timer[7].SetInterval(2700); // Wavemaker 4 with 2700s interval
ReefAngel.Timer[7].Start(); // Start Wavemaker 4 timer
ReefAngel.Relay.On(Port7); // Turn on Wavemaker 4
// ...
// Relay.On() function calls
}
Code: Select all
void loop()
{
// existing code goes here
// code for ports
// ...
ReefAngel.Wavemaker(Port6, 6); // Wavemaker 3 attached to Port6 using Timer6
ReefAngel.Wavemaker(Port7, 7); // Wavemaker 4 attached to Port7 using Timer7
// ...
// exising code for any web banner stuff
}
Curt
Re: how to add additional wavemakers
May I suggest another approach?
Why not create 2 new instances of Timer and have Relay.Toggle() every time the timer expires?
I think the libraries modification is not recommended as Curt said.
This approach will not give you the menu driven setup of the wavemaker that Curt has in his RAGen, but it is a solution.
Why not create 2 new instances of Timer and have Relay.Toggle() every time the timer expires?
I think the libraries modification is not recommended as Curt said.
This approach will not give you the menu driven setup of the wavemaker that Curt has in his RAGen, but it is a solution.
Roberto.
Re: how to add additional wavemakers
Thanks for the example Curt, I will have to give it a spin later today. Will also try what Roberto suggested and see which works best.
Thanks for the help guys, again great work on the controller and support!
Tim
Thanks for the help guys, again great work on the controller and support!
Tim
Re: how to add additional wavemakers
Yep, this actually is the best solution. My brain wasn't fully functioning with all the possible solutions last night. And I'm always thinking in library mode because I maintain it.rimai wrote:May I suggest another approach?
Why not create 2 new instances of Timer and have Relay.Toggle() every time the timer expires?
I think the libraries modification is not recommended as Curt said.
This approach will not give you the menu driven setup of the wavemaker that Curt has in his RAGen, but it is a solution.
Here's the solution that Roberto is talking about:
Code: Select all
// ... other code
ReefAngel_TimerClass wmtimers[2];
// setup
void setup()
{
// ...
// Wavemaker 3 timer
wmtimers[0].SetInterval(1800);
wmtimers[0].Start();
ReefAngel.Relay.On(Port6);
// Wavemaker 4 timer
wmtimers[1].SetInterval(2700);
wmtimers[1].Start();
ReefAngel.Relay.On(Port7);
// ...
}
void loop()
{
// ...
// check for wavemaker 3 toggling
if ( wmtimers[0].IsTriggered() )
{
wmtimers[0].Start();
ReefAngel.Relay.Toggle(Port6);
}
// check for wavemaker 4 toggling
if ( wmtimers[1].IsTriggered() )
{
wmtimers[1].Start();
ReefAngel.Relay.Toggle(Port7);
}
// ...
}
I'd actually recommend this over my solution for simplicity.
curt
Re: how to add additional wavemakers
Works like a charm.
Thanks guys.
Tim
Thanks guys.
Tim