SO what I want to do is have this else mode on during the day 0600-2000 = 45% +/- 15
and else mode at night 2000 - 0600 = 35% +/- 5%
I have reefbreeders LEDs and they have their own controller so i do not have the lights on a schedule so i am not sure which dimming switch to plug the jebao into. or if it matters.
I have port 5 as my extra power head on during the day
and port 6 is where I will plug my jebao into.
here is my wizard drafted code.
I have not added in the else mode code yet cause i dont completely understand how the actinic / daylight section works or the schedule I want.
Thank you in advance
EDIT: I found some other threads with schedules in them and got them working. however I uploaded my code but both my dimming channels are at 0% right now even though it should be on else mode.
ideas?
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>
////// 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.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port4Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 869 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port6 );
ReefAngel.Relay.On( Port7 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port3,771,775 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.Relay.Set( Port5, !ReefAngel.Relay.Status( Port4 ) );
ReefAngel.StandardFan( Port8,775,780 );
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.SetMode( ShortPulse,40,30 );
ReefAngel.DCPump.DaylightChannel = None;
ReefAngel.DCPump.ActinicChannel = Sync;
////// Place your custom code below here
if (ReefAngel.DCPump.Mode==Custom)
{
if ( (now()%SECS_PER_DAY >= 28800) || (now()%SECS_PER_DAY<= 72000) ) //0800-2000
{
ReefAngel.PWM.SetActinic( ElseMode(45,15,true)); //
}
else if ( (now()%SECS_PER_DAY >= 72000) && (now()%SECS_PER_DAY<= 28800) )
{
ReefAngel.PWM.SetActinic( ElseMode(35,5,true)); // Else on sync mode, 36 +/- 6%
}
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "iratefrizz" );
ReefAngel.ShowInterface();
}
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;
}
}