I have a WP40 pump and i want set it in ELSE mode, I make a code with the wizard for the things i need, but i'll to use ELSE mode instead of the ones provided in the wizard i found a code in the Addons section that will work for what i want, but i don't how to add it to the code and how to set the intervals i want, this is my code:
Code: Select all
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <[color=#CC6600]Wire[/color].h>
#include <[color=#CC6600]OneWire[/color].h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <[color=#006699]LED[/color].h>
#include <RA_TempSensor.h>
#include <[color=#006699]Relay[/color].h>
#include <RA_PWM.h>
#include <[color=#006699]Timer[/color].h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <[color=#006699]Salinity[/color].h>
#include <[color=#006699]RF[/color].h>
#include <[color=#006699]IO[/color].h>
#include <[color=#006699]ORP[/color].h>
#include <[color=#006699]AI[/color].h>
#include <[color=#006699]PH[/color].h>
#include <[color=#006699]WaterLevel[/color].h>
#include <[color=#006699]Humidity[/color].h>
#include <[color=#006699]DCPump[/color].h>
#include <[color=#CC6600]ReefAngel[/color].h>
[color=#7E7E7E]////// Place global variable code below here[/color]
[color=#7E7E7E]////// Place global variable code above here[/color]
[color=#CC6600]void[/color] [color=#CC6600][b]setup[/b][/color]()
{
[color=#7E7E7E]// This must be the first line[/color]
[color=#CC6600]ReefAngel[/color].[color=#CC6600]Init[/color](); [color=#7E7E7E]//Initialize controller[/color]
[color=#CC6600]ReefAngel[/color].[color=#CC6600]SetTemperatureUnit[/color]( [color=#006699]Celsius[/color] ); [color=#7E7E7E]// set to Celsius Temperature[/color]
[color=#7E7E7E]// Ports toggled in Feeding Mode[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]FeedingModePorts[/color] = [color=#006699]Port8Bit[/color];
[color=#7E7E7E]// Ports toggled in Water Change Mode[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]WaterChangePorts[/color] = [color=#006699]Port1Bit[/color] | [color=#006699]Port7Bit[/color] | [color=#006699]Port8Bit[/color];
[color=#7E7E7E]// Ports toggled when Lights On / Off menu entry selected[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]LightsOnPorts[/color] = 0;
[color=#7E7E7E]// Ports turned off when Overheat temperature exceeded[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]OverheatShutoffPorts[/color] = [color=#006699]Port8Bit[/color];
[color=#7E7E7E]// Use T1 probe as temperature and overheat functions[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]TempProbe[/color] = [color=#006699]T1_PROBE[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]OverheatProbe[/color] = [color=#006699]T1_PROBE[/color];
[color=#7E7E7E]// Set the Overheat temperature setting[/color]
[color=#CC6600]InternalMemory[/color].[color=#CC6600]OverheatTemp_write[/color]( 300 );
[color=#7E7E7E]// Feeeding and Water Change mode speed[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]FeedingSpeed[/color]=0;
[color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]WaterChangeSpeed[/color]=0;
[color=#7E7E7E]// Ports that are always on[/color]
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port7[/color] );
[color=#CC6600]ReefAngel[/color].[color=#006699]Relay[/color].[color=#CC6600]On[/color]( [color=#006699]Port8[/color] );
[color=#7E7E7E]////// Place additional initialization code below here[/color]
[color=#7E7E7E]////// Place additional initialization code above here[/color]
}
[color=#CC6600]void[/color] [color=#CC6600][b]loop[/b][/color]()
{
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardATO[/color]( [color=#006699]Port1[/color],600 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Port2[/color],15,0,22,30 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Port3[/color],15,30,22,0 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]MHLights[/color]( [color=#006699]Port4[/color],16,0,21,30,1 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Port5[/color],10,29,23,0 );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]StandardLights[/color]( [color=#006699]Port6[/color],23,0,11,0 );
[color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]UseMemory[/color] = [color=#CC6600]false[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#CC6600]SetMode[/color]( TidalSwell,80,10 );
[color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]DaylightChannel[/color] = [color=#006699]Sync[/color];
[color=#CC6600]ReefAngel[/color].[color=#006699]DCPump[/color].[color=#006699]ActinicChannel[/color] = [color=#006699]None[/color];
[color=#7E7E7E]////// Place your custom code below here[/color]
[color=#7E7E7E]////// Place your custom code above here[/color]
[color=#7E7E7E]// This should always be the last line[/color]
[color=#CC6600]ReefAngel[/color].[color=#CC6600]Portal[/color]( [color=#006699]"symon_say"[/color] );
[color=#CC6600]ReefAngel[/color].[color=#CC6600]ShowInterface[/color]();
}
Code: Select all
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
// Static's only initialize the first time they are called
static unsigned long LastChange=millis(); // Set the inital time that the last change occurred
static int Delay = random( 500, 3000); // Set the initial delay
static int NewSpeed = MidPoint; // Set the initial speed
static int AntiSpeed = MidPoint; // Set the initial anti sync speed
if ((millis()-LastChange) > Delay) // Check if the delay has elapsed
{
Delay=random(500,5000); // If so, come up with a new delay
int ChangeUp = random(Offset); // Amount to go up or down
if (random(100)<50) // 50/50 chance of speed going up or going down
{
NewSpeed = MidPoint - ChangeUp;
AntiSpeed = MidPoint + ChangeUp;
}
else
{
NewSpeed = MidPoint + ChangeUp;
AntiSpeed = MidPoint - ChangeUp;
}
LastChange=millis(); // Reset the time of the last change
}
if (WaveSync)
{
return NewSpeed;
}
else
{
return AntiSpeed;
}
}