Please look at my code below, the on time for today for my lights is 10:46 and off time of 00:00.
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 <ReefAngel.h>
#include <SunLocation.h>
////// Place global variable code below here
byte wp40mode; //Mode Byte
SunLocation sl;
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
// Add Standard Menu
ReefAngel.AddStandardMenu();
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit | Port5Bit | Port6Bit | Port7Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
ReefAngel.Relay.On( Port3 ); //Mag 12 Return Pump
////// Place additional initialization code below here
{
ReefAngel.Init();
// initialize the sunrise / sunset location
sl.Init(28.253831, -81.264846); // Latitude , Longitude values set
}
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.DayLights( Port1 ); //T5HO Day Lights (Whites)
ReefAngel.ActinicLights( Port2 ); //T5HO Actinic Lights (Blues)
ReefAngel.Relay.DelayedOn( Port4 ); //Reef Octopus NW150 Skimmer and Phosban
ReefAngel.StandardFan( Port6 ); //Cooling Fans
ReefAngel.DosingPumpRepeat1( Port7 ); //Dosing Pump
ReefAngel.StandardATO( Port8 ); //ATO Pump
////// Place your custom code below here
{
// handle updating sunrise and sunset values
sl.CheckAndUpdate();
ReefAngel.ShowInterface();
}
// Dimmable royal blues 100% if actinics (relay port 2) are on, else moonlight
if ReefAngel.Relay.IsMaskOn(Port2); {
ReefAngel.PWM.SetActinic( 100 );
}
else {
ReefAngel.PWM.SetActinic( MoonPhase() );
}
//Start Feeding Mode at 17:00 (hour*60*60)
if ( (now()%86400==61200) /*|| (now()%86400==39600) */) {
ReefAngel.FeedingModeStart();
}
//Hydor Evolution 1400 Circulation Pump Port5 Off Between 10pm and 8am
if (hour()<8 || hour()>=22) {
ReefAngel.Relay.Off(Port5);
}
else {
ReefAngel.Relay.On(Port5);
}
//assignmenets are = and comparisons are ==
if (hour()>=8 && hour()<12) wp40mode=7; //8am - 11:59am
else if (hour()>=12 && hour()<17) wp40mode=6; //12pm - 4:59pm
else if (hour()>=17 && hour()<18) wp40mode=5; //5pm - 5:59pm
else if (hour()>=18 && hour()<24) wp40mode=3; //6pm - 11:59pm
else wp40mode=4; //12am - 7:59am
if (wp40mode==9) ReefAngel.PWM.SetDaylight( 100 ); //Full Speed
if (wp40mode==8) ReefAngel.PWM.SetDaylight( 100/3 ); //Third Speed
if (wp40mode==7) ReefAngel.PWM.SetDaylight( millis()%1100>800?75:0); //Custom "W1"
if (wp40mode==6) ReefAngel.PWM.SetDaylight( TidalSwellMode(80,true ) ); //WaveMaxSpeed, PulseSync
if (wp40mode==5) ReefAngel.PWM.SetDaylight( NutrientTransportMode(0,65,2000,true ) ); //PulseMinSpeed, PulseMaxSpeed, PulseDuration (ms), PulseSync
if (wp40mode==4) ReefAngel.PWM.SetDaylight( LongPulseMode(0,50,3,true ) ); //PulseMinSpeed, PulseMaxSpeed, PulseDuration (s), PulseSync
if (wp40mode==3) ReefAngel.PWM.SetDaylight( ShortPulseMode(0,80,1200,true ) ); //PulseMinSpeed, PulseMaxSpeed, PulseDuration (ms), PulseSync
if (wp40mode==2) ReefAngel.PWM.SetDaylight( ReefCrestMode(50,20,true ) ); //WaveSpeed, WaveOffset, PulseSync
if (wp40mode==1) ReefAngel.PWM.SetDaylight( SineMode(0,100,10,true ) ); //PulseMinSpeed, PulseMaxSpeed, PulseDuration (ms), PulseSync
if (wp40mode==0) ReefAngel.PWM.SetDaylight( TideMode(20,100,20 ) ); //WaveSpeed, minOffset, maxOffset
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "clw143" );
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
byte x = 6;
byte y = 2;
byte t;
char text[7];
ReefAngel.LCD.Clear(DefaultBGColor,0,0,132,132);
ReefAngel.LCD.DrawDate(6, 3);
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 11, 132, 11);
pingSerial();
ReefAngel.LCD.DrawText(0,255,18,14,"Jebao WP40 Mode:");
if (wp40mode==0) ReefAngel.LCD.DrawLargeText(COLOR_GREEN,255,42,25,"Tide");
else if(wp40mode==1) ReefAngel.LCD.DrawLargeText(COLOR_RED,255,42,25,"Sine");
else if (wp40mode==2) ReefAngel.LCD.DrawLargeText(COLOR_ORANGE,255,23,25,"Reef Crest");
else if (wp40mode==3) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,23,25,"Short Pulse");
else if (wp40mode==4) ReefAngel.LCD.DrawLargeText(COLOR_CORNFLOWERBLUE,255,23,25,"Long Pulse");
else if (wp40mode==5) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,8,25,"Nutrient Trnsp.");
else if (wp40mode==6) ReefAngel.LCD.DrawLargeText(COLOR_MAGENTA,255,23,25,"Tidal Swell");
else if (wp40mode==7) ReefAngel.LCD.DrawLargeText(COLOR_BLUE,255,40,25,"Custom");
else if (wp40mode==8) ReefAngel.LCD.DrawLargeText(COLOR_BLUE,255,25,25,"1/3 Power");
else if (wp40mode==9) ReefAngel.LCD.DrawLargeText(COLOR_BLUE,255,23,25,"Full Power");
pingSerial();
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 34, 132, 34);
ReefAngel.LCD.DrawText(0,255,10,37,"Disp");
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 8, 45, text, Num8x8);
pingSerial();
ReefAngel.LCD.DrawText(0,255,53,37,"Room");
ConvertNumToString(text, ReefAngel.Params.Temp[T2_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 50, 45, text, Num8x8);
pingSerial();
ReefAngel.LCD.DrawText(0,255,95,37,"Sump");
ConvertNumToString(text, ReefAngel.Params.Temp[T3_PROBE], 10);
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 93, 45, text, Num8x8);
pingSerial();
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 53, 132, 53);
ReefAngel.LCD.DrawText(0,255,10,56,"pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 27, 56, text, Num8x8);
pingSerial();
ReefAngel.LCD.DrawText(0,255,67,56,"WP40");
ConvertNumToString(text, ReefAngel.PWM.GetDaylightValue(),1);
ReefAngel.LCD.DrawLargeText(COLOR_BLUE, 255, 95, 56, text, Num8x8);
ReefAngel.LCD.DrawText(0,255,118,56," %");
ReefAngel.LCD.Clear(COLOR_BLACK, 1, 65, 132, 65);
pingSerial();
ReefAngel.LCD.DrawLargeText(COLOR_BLUE,255,7,85,"Shaun");
ReefAngel.LCD.DrawHugeText(COLOR_RED, 255, 50, 88,"&");
ReefAngel.LCD.DrawLargeText(COLOR_GREEN,255,70,98,"Kerri's");
ReefAngel.LCD.DrawLargeText(0,255,7,108,"90Gal Reef Tank");
pingSerial();
{
char buf[16];
sprintf(buf, "%02d:%02d", sl.GetRiseHour(), sl.GetRiseMinute());
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,10,67,"Sunrise: ");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,58,67,buf);
sprintf(buf, "%02d:%02d", sl.GetSetHour(), sl.GetSetHour());
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,10,75,"Sunset: ");
ReefAngel.LCD.DrawText(DefaultFGColor,DefaultBGColor,58,75,buf);
}
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 118, TempRelay);
pingSerial();
}
void DrawCustomGraph()
{
}