new wavemaker snippet in .9.4

Do you have a question on how to do something.
Ask in here.
Post Reply
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

new wavemaker snippet in .9.4

Post by rossbryant1956 »

How do I change my code in which I do this:

Code: Select all

ReefAngel.WavemakerRandom(Port5,15,60); // Turn Port5 on/off random cycles that lasts from 15 to 60 secs
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5)); // Turn Port6 on/off on opposite cycle as Port 5
    // Port 5 and 6 are synchronized.
    // They work in opposing motion of each other at random times.
to use the new code

Code: Select all

ReefAngel.WavemakerToggle(WMRelay1, WMRelay2, WMTimer);
Thx in advance.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: new wavemaker snippet in .9.4

Post by binder »

This should accomplish that for you. First, you gotta randomize the timer. Once you get the random value for the timer, you have to check if the timer is expired or not, then update.

Place this code inside your loop()

Code: Select all

// Randomize the Timer
static time_t timer=now()+15;
if (now()>timer)
{
	timer=now()+random(15, 60);
}

ReefAngel.WavemakerToggle(Port5, Port6, timer);
I have not tested this code. It should work, but I would test it out first or at least watch it to ensure it works as expected. I'm planning on testing this out later tonight or tomorrow.
rossbryant1956
Posts: 471
Joined: Sat Jan 14, 2012 2:08 pm
Location: Montgomery Village, MD

Re: new wavemaker snippet in .9.4

Post by rossbryant1956 »

I finally got time to play with this and although it works it seems weird.

The first two times it switched okay, it first was in about 15-20 seconds, the second in a minute or so, the third, fourth, and fifth are getting longer and longer, now up to about 6 or so minutes prior to switching...

So perhaps that is as designed but I wanted to check in... What do others think that have used this new code?

Thx in advance.
Roscoe's Reefs - Starting Over Again:

Building new 29g Nano after landlord went berserk over my 4 75 gallon tanks, Multiple RA's, Water mixing stations, etc. Your help welcomed in remembering all I've forgotten.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: new wavemaker snippet in .9.4

Post by binder »

Yeah, I could see how it could possibly increase at times. The reasoning is you are randomizing all of the intervals and that could cause some lengthening of the timers. This function was ideally created for those who use a static interval instead of a random interval. I may have to test it more to see how this code functions in real time.
knapp870
Posts: 39
Joined: Mon Apr 16, 2012 10:52 am
Location: Kansas City, MO

Re: new wavemaker snippet in .9.4

Post by knapp870 »

Any updates on this? I'm fine using a standard wave maker interval, but think it would be great to have a random toggle like this, taking into account of the status of the other wave maker.
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: new wavemaker snippet in .9.4

Post by binder »

No updates on it currently. I've been working on expansion relay support inside the Android Reef Angel Status app.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: new wavemaker snippet in .9.4

Post by rimai »

Have you tried one of the example codes?
File->Sketchbook->Example Codes->Wavemaker_Random_Sync
Roberto.
abhi_123
Posts: 216
Joined: Tue Mar 20, 2012 8:34 am

Re: new wavemaker snippet in .9.4

Post by abhi_123 »

This timer facility is not coming to my expectations. i have calculated a 5 min switch off between the pumps.
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: new wavemaker snippet in .9.4

Post by binder »

abhi_123 wrote:This timer facility is not coming to my expectations. i have calculated a 5 min switch off between the pumps.
What code exert are you using that you calculated a 5 minute switch off?
abhi_123
Posts: 216
Joined: Tue Mar 20, 2012 8:34 am

Re: new wavemaker snippet in .9.4

Post by abhi_123 »

Curt,

the same one which you have posted in the beginning of this thread.

FYI I have posted the timer inside the loop.
Image
Post Reply