wavemaker

Related to the development libraries, released by Curt Binder
Post Reply
cain
Posts: 83
Joined: Tue Aug 02, 2011 10:59 am

wavemaker

Post by cain »

can the wavemaker function go random?
i mean when you enter 100s for wavemaker 1, can it do random time from 1-100s not the full 100s?
also, is it possible for RA to give a command =
if wavemaker 1 is off, then wavemaker 2 on, if wavemaker 1 is on, then wavemaker 2 is off.

TIA.
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: wavemaker

Post by binder »

cain wrote:can the wavemaker function go random?
i mean when you enter 100s for wavemaker 1, can it do random time from 1-100s not the full 100s?
It currently cannot go random. You could code something that you would specify the amount of time (like 100s) and then after each interval you would randomly generate a new time.
This would be something like what you are wanting. At startup, whatever the value you have set for the WM1 timer is used to generate a random number from 0 to it. After every cycle a new number is generated so the off & on times will not be the same.

Code: Select all

void setup()
{
	randomSeed(analogRead(0));
	ReefAngel.Init();

	ReefAngel.Timer[1].SetInterval(random(InternalMemory.WM1Timer_read()));
	ReefAngel.Timer[1].Start();
	ReefAngel.Relay.On(Port4);
}

void loop()
{
	ReefAngel.ShowInterface();

	if ( ReefAngel.Timer[1].IsTriggered() )
	{
		ReefAngel.Timer[1].SetInterval(random(InternalMemory.WM1Timer_read()));
		ReefAngel.Timer[1].Start();
		ReefAngel.Relay.Toggle(Port4);
	}
}
This code is for WM1 only. If you want additional timers to control additional wavemakers, you will have to use Timer[2] (for wm2). Or, if you want both wavemakers to use this same random interval you can. You will want to change the On(Port4) and Toggle(Port4) to be whatever port(s) you want. You could even have it set to use them with the same interval only on the exact opposite pattern (WM2 is off when WM1 is on and vice versa). That would be like this:

Code: Select all

void setup()
{
	randomSeed(analogRead(0));
	ReefAngel.Init();

	ReefAngel.Timer[1].SetInterval(random(InternalMemory.WM1Timer_read()));
	ReefAngel.Timer[1].Start();
	ReefAngel.Relay.On(Port4);
}

void loop()
{
	ReefAngel.ShowInterface();

	if ( ReefAngel.Timer[1].IsTriggered() )
	{
		ReefAngel.Timer[1].SetInterval(random(InternalMemory.WM1Timer_read()));
		ReefAngel.Timer[1].Start();
		ReefAngel.Relay.Toggle(Port4);
		ReefAngel.Relay.Toggle(Port5);  // added this line
	}
}
This should be enough to get you going.

Also note, you will NOT use the Wavemaker1, Wavemaker2, or Wavemaker functions at all when using this code. The code is also based off of my dev libraries. I also did not include all the "include" statements at the top.
also, is it possible for RA to give a command =
if wavemaker 1 is off, then wavemaker 2 on, if wavemaker 1 is on, then wavemaker 2 is off.
You want to issue a command that turns off wm1 then immediately turns on wm2 and then when wm2 turns off immediately turn on wm1? So once you set wm1, it just toggles wm1 & wm2 back and forth?
See the second code example above if that's the case.

curt
cain
Posts: 83
Joined: Tue Aug 02, 2011 10:59 am

Re: wavemaker

Post by cain »

Tried it, and worked like a charm. TY.

Now to the next.

i plugged in my head unit to the ph probe and the temp sensor.
ph probe displayed properly but temperature values didnt display in the head unit.
values are all zero (0) i tried all 3 ports for the temp and nothing seems to display the value.

i also have a question with regards to ATO,
if i'm going to use the "single ATO low' this means that, if the flaot switch falls down, the ATO port turns on to activate the pump, and when the float switch rises it turns off the pump.

how does "dual ATO" works?
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: wavemaker

Post by rimai »

Roberto.
Post Reply