Here's the PDE. (NOTE: there are a few things commented out right now as I work my way through the coding)
Code: Select all
#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <ReefAngel.h>
/*
Ports assignment:
Port1 - Standard ATO
Port2 - Skimmer
Port3 - Always On
Port4 - Heater
Port5 - Wavemaker 1
Port6 - Wavemaker 2
Port7 - SeaSwirl
Port8 - Return
*/
#define PWMRB1 0
#define PWMRB2 1
#define PWMRB3 2
#define PWMWT1 3
#define PWMWT2 4
#define PWMHN 5
byte PWMChannel[]={
0,0,0,0,0,0};
void setup()
{
ReefAngel.Init();
ReefAngel.FeedingModePorts = Port2Bit | Port5Bit | Port6Bit | Port8Bit; // Turn off Port6 and Port8 when feeding mode is activated
ReefAngel.WaterChangePorts = Port2Bit | Port4Bit | Port8Bit; // Turn off Port5, Port6, Port7 and Port8 when water change mode is activated
ReefAngel.Relay.On(Port2); // Turn on Skimmer
ReefAngel.Relay.On(Port3); // Turn on Always On port
ReefAngel.Relay.On(Port7); // Turn on SeaSwirl
ReefAngel.Relay.On(Port8); // Turn on return
}
void loop()
{
ReefAngel.StandardATO(Port1, 60); // ATO with 60 seconds timeout
ReefAngel.StandardHeater(Port4,770,780); //Standard heater comes on at 77 degrees and off at 78 degrees
ReefAngel.WavemakerRandom1(Port5,15,60);//Turn on/off Wavemaker 1 random cycles from 15 to 60 seconds
ReefAngel.WavemakerRandom2(Port6,15,60);//Turn on/off Wavemaker 1 random cycles from 15 to 60 seconds
//** Moonphase Code Start Here
if (hour ()>=21 || hour ()<10)
{
ReefAngel.PWM.SetActinic(MoonPhase());
}
else
{
ReefAngel.PWM.SetActinic(0);
}
//** Moonphase Code Ends Here
//** Daylight PWM Channel Code Starts Here
if (hour()>=21 || hour()<12)
{
ReefAngel.PWM.SetDaylight(0);
}
else
{
ReefAngel.PWM.SetDaylight(PWMSlope(12,00,20,30,13,95,120,13)); //XP-G Cool Whites - Right Side
}
//** Daylight PWM Channel Code Ends Here
//** PWM Expansion Module Code Starts Here
PWMChannel[PWMRB2]=PWMSlope(9,30,21,20,10,95,60,PWMChannel[PWMRB2]); //Royal Blue - Left Bank
//PWMChannel[PWMRB3]=PWMSlope(9,50,21,40,0,95,60,PWMChannel[PWMRB3]); //Royal Blue - Middle Bank
//PWMChannel[PWMRB1]=PWMSlope(10,10,22,00,0,95,60,PWMChannel[PWMRB1]); //Royal Blue - Right Bank
//PWMChannel[PWMWT2]=PWMSlope(11,00,21,00,0,95,80,PWMChannel[PWMWT2]); //XP-E Cool Whites - Left Side
//PWMChannel[PWMWT1]=PWMSlope(11,10,21,30,0,95,80,PWMChannel[PWMWT1]); //XP-E Cool Whites - Right Side
//PWMChannel[PWMHN]=PWMSlope(12,00,20,00,0,95,120,PWMChannel[PWMHN]); //XP-G Cool Whites - Left Side
for (int a=0;a<6;a++)
{
ReefAngel.PWM.Expansion(a,int(2.55*PWMChannel[a]));
}
//** PWM Expansion Module Code Ends Here
ReefAngel.ShowInterface(); //Draw the Standard Interface
}
Dave