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.
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:
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.
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.
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:
You need to change that line to be this
Code: Select all
ReefAngel_TimerClass Timer[8]; // Added 2 additional timers
Once this change has been made, save the file. This is all the changes that you need to make to the libraries.
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
}
Moving down to the loop() section, we will add this:
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
}
Then you should just save the PDE file and you are ready to go. If you ever needed to change the interval, you would just modify it in the setup() section and re-upload it to the controller.
Curt