Code: Select all
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>
////// Place global variable code below here
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.PHMin=511;
ReefAngel.PHMax=760;
InternalMemory.DCPumpThreshold_write(15);
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port4Bit | Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port2Bit | Port3Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port7Bit | Port8Bit;
// Use T3 probe as temperature and overheat functions
ReefAngel.TempProbe = T2_PROBE;
ReefAngel.OverheatProbe = T2_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 835 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=16;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port2 ); //Dimming Module
ReefAngel.Relay.On( Port4 ); //Jebao DP4
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port6 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port1,780,790 );
ReefAngel.StandardLights( Port3,12,00,22,00 ); // Secondary Pump
ReefAngel.StandardLights( Port7,0,30,10,30 ); // Fuge Lamp
ReefAngel.DCPump.ExpansionChannel[0] = None;
ReefAngel.DCPump.ExpansionChannel[1] = None;
ReefAngel.DCPump.ExpansionChannel[2] = None;
ReefAngel.DCPump.ExpansionChannel[3] = None;
ReefAngel.DCPump.ExpansionChannel[4] = None;
ReefAngel.DCPump.ExpansionChannel[5] = None;
////// Place your custom code below here
////// Light Schedule Below
//Set Channel 0 LED RED
if (PWMSlope(13,15,22,45,5,85,120,5)<=6)
{
ReefAngel.PWM.SetChannel( 0, 0);
ReefAngel.PWM.SetChannel( 3, 0);
}
else
{
ReefAngel.PWM.SetChannel( 0, PWMSlope(13,15,22,45,5,85,120,5) );
ReefAngel.PWM.SetChannel( 3, PWMSlope(13,15,22,45,5,85,120,5) );
}
//Set Channel 1 LED WHITE
if (PWMSlope(13,30,22,30,5,80,120,5)<=6)
{
ReefAngel.PWM.SetChannel( 1, 0);
ReefAngel.PWM.SetChannel( 4, 0);
}
else
{
ReefAngel.PWM.SetChannel( 1, PWMSlope(13,30,22,30,5,80,120,5) );
ReefAngel.PWM.SetChannel( 4, PWMSlope(13,30,22,30,5,80,120,5) );
}
//Set Channel 2 LED BLUE
if (PWMSlope(13,0,23,0,5,100,120,5)<=6)
{
ReefAngel.PWM.SetChannel( 2,0);
ReefAngel.PWM.SetChannel( 5,0);
}
else
{
ReefAngel.PWM.SetChannel( 2, PWMSlope(13,0,23,0,5,100,120,5) );
ReefAngel.PWM.SetChannel( 5, PWMSlope(13,0,23,0,5,100,120,5) );
}
////// End of Light Schedule
//Setting Jebao Pump Wave Patterns
if (hour()>=12 && hour()<13 ) // Morning mode between 12pm and 1pm
{
ReefAngel.DCPump.SetMode(ReefCrest,40,20 );
}
else if (hour()>=13 && hour()<15) // Day mode between 1m and 3pm
{
ReefAngel.DCPump.SetMode( ReefCrest,50,25 );
}
else if (hour()>=15 && hour()<20) // Day mode between 3pm and 8pm
{
ReefAngel.DCPump.SetMode( ReefCrest,75,25 );
}
else if (hour()>=20 && hour()<21) // Evening mode between 8pm and 9pm
{
ReefAngel.DCPump.SetMode( ReefCrest,60,15 );
}
else if (hour()>=21 && hour()<23) //Calming beween 9pm and 11pm
{
ReefAngel.DCPump.SetMode( ReefCrest,40,20 );
}
else
{
ReefAngel.DCPump.SetMode( ReefCrest,40,10 ); // Night Mode between 11pm and l2pm
}
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync; //use None when inactivated
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "civics14" );
ReefAngel.ShowInterface();
}