Page 1 of 1

Toggling a port off during feeding

Posted: Sat Mar 31, 2012 7:14 pm
by grafspee1217
Hi there,
I am planning on putting a return pump on port 1 and a skimmer pump on port 2. If I set them to always on with RAGen will they turn off during feeding mode? The feeding mode allows you to toggle specific ports from what I can tell.

I am going to add a temp probe to the heatsink for the LED's. How do I code a port to turn on when the temp rises to a certain point and off when it drops to a given temp? Havent been able to find anything on that.

Lastly, If I use a PWM slope for the LED's can I use the standard lights to bring on the moonlights?

Thanks for the help

Re: Toggling a port off during feeding

Posted: Sat Mar 31, 2012 8:08 pm
by binder
grafspee1217 wrote:Hi there,
I am planning on putting a return pump on port 1 and a skimmer pump on port 2. If I set them to always on with RAGen will they turn off during feeding mode? The feeding mode allows you to toggle specific ports from what I can tell.
http://forum.reefangel.com/viewtopic.php?f=7&t=595
Yes, if you have the port selected to toggle for feeding mode then it will be turned off when feeding mode is entered and turned back on when feeding mode is exited.
I am going to add a temp probe to the heatsink for the LED's. How do I code a port to turn on when the temp rises to a certain point and off when it drops to a given temp? Havent been able to find anything on that.
If you are using the latest libraries (0.9.0 or later), you would do something like this:

Code: Select all

void loop()
{
    // rest of code functions
    if ( ReefAngel.Params.Temp[T2_PROBE] > 890 ) {
      // if probe 2 is greater than 89.0 degrees F, turn off port 1
      ReefAngel.Relay.Off(Port1);
    } else {
      // otherwise the temp is below 89.0 F, so keep port 1 on
      ReefAngel.Relay.On(Port1);
    }

    // rest of code functions
    ReefAngel.ShowInterface();
}
Lastly, If I use a PWM slope for the LED's can I use the standard lights to bring on the moonlights?

Thanks for the help
Depends on how your moonlights are connected. If your moonlights just use a regular relay / outlet, then yes you can. You can either do it one of 2 ways. You can use StandardLights and have that schedule be your overnight schedule OR you can have StandardLights be your normal daytime schedule and use the MoonLights function. That would be coded like this:

Code: Select all

ReefAngel.MoonLights(Port4);
MoonLights function operates on the OPPOSITE schedule of the StandardLights function.

Re: Toggling a port off during feeding

Posted: Sat Mar 31, 2012 8:32 pm
by grafspee1217
would this work?
void loop()
{
// rest of code functions
if ( ReefAngel.Params.Temp[T2_PROBE] > 1200 ) {
// if probe 2 is greater than 120.0 degrees F, turn on port 1
ReefAngel.Relay.on(Port1);
} else {
// otherwise the temp is below 120.0 F, so keep port 1 off
ReefAngel.Relay.off(Port1);
}

// rest of code functions
ReefAngel.ShowInterface();
}

Re: Toggling a port off during feeding

Posted: Sat Mar 31, 2012 8:59 pm
by rimai
To make it easier, you can use this too:

Code: Select all

ReefAngel.Relay.Set(Port1,ReefAngel.Params.Temp[T2_PROBE] > 1200);
But this is really not what you want to do it either.
This will just make whatever is on Port1 to keep toggling on/off multiple times.
What you really want to use is the StandardFan() function.
Use this instead:

Code: Select all

ReefAngel.StandardFan(Port1,1150,1200); Turns Port1 on at 120.0F and off at 115.0F

Re: Toggling a port off during feeding

Posted: Sat Mar 31, 2012 9:15 pm
by grafspee1217
Good point, it would toggle off at 119 and back on at 120
I can designate whatever port I want?
Does the controller ignore the comment after the ; or is the statement required?
Wouldn't the standard fan function be tied to probe 1 which is my tank's water temp?
I had planned on using probe 2 for the LED heatsink temp

Re: Toggling a port off during feeding

Posted: Sun Apr 01, 2012 7:47 am
by rimai
Good point on the probe.
You can use the same guts of the function, which is this:

Code: Select all

	if (Params.Temp[T2_PROBE] >= 1200) Relay.On(Port1);  // If sensor 1 temperature >= HighTemp - turn on fan
	if (Params.Temp[T2_PROBE] <= 1190) Relay.Off(Port1);  // If sensor 1 temperature <= LowTemp - turn off fan
You can change the Port to whatever you choose. I just used Port1 as an example.
What tells the compiler that something is a comment is the //. Anything after it will be considered comment.