Lighting code
Lighting code
Hi i was wondering if anyone could tell me how to turn on port 5 of the relay box at 06:00 and off at 08:05 then on at 18:00 and off at 20:05
know nuthing about coding
Thanks
Mask0017
know nuthing about coding
Thanks
Mask0017
Re: Lighting code
This could work for you.mask0017 wrote:Hi i was wondering if anyone could tell me how to turn on port 5 of the relay box at 06:00 and off at 08:05 then on at 18:00 and off at 20:05
know nuthing about coding
Thanks
Mask0017
Code: Select all
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
Re: Lighting code
this is my code now does that look okay?
#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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( TidalSwell,70,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = None;
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "mask0017" );
ReefAngel.ShowInterface();
}
#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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( TidalSwell,70,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = None;
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "mask0017" );
ReefAngel.ShowInterface();
}
Re: Lighting code
Actually, there is a need of a check or the 2nd function will always override the first.
This should work:
This should work:
Code: Select all
if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
Roberto.
Re: Lighting code
I don't think that would work Curt. The second iteration would shut off the port from 6:00 - 8:05. It's not like the dimming code where you can nest it.
I would do this:
I'm using 12 as an arbitrary time to do one versus the other, so that can easily be changed to whatever you like.
LOL - Roberto came up with the same solution
I would do this:
Code: Select all
if ( hour() < 12 ) {
ReefAngel.StandardLights(Port5,6,0,8,5);
} else {
ReefAngel.StandardLights(Port5,18,0,20,5);
}
LOL - Roberto came up with the same solution
Re: Lighting code
heres my code now would that work?
#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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( TidalSwell,70,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = None;
////// Place your custom code below here
if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "mask0017" );
ReefAngel.ShowInterface();
}
Thanks for the help totally lost with coding
#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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( TidalSwell,70,10 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = None;
////// Place your custom code below here
if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "mask0017" );
ReefAngel.ShowInterface();
}
Thanks for the help totally lost with coding
Re: Lighting code
Yes, but I would take out the extra Port5 calls earlier in the file just to avoid confusion
Re: Lighting code
Thanks got that done will see how it goes.
Big thanks to everyone for the help
Big thanks to everyone for the help
Re: Lighting code
Yeah, I was wondering about that. I couldn't remember off hand about the multiple statements in a row.
Guess I'm slipping and "losing my touch". haha
Guess I'm slipping and "losing my touch". haha