multiple ON/Off Lights

Do you have a question on how to do something.
Ask in here.

Posts: 35
Joined: Sun Mar 31, 2013 4:28 am
Location: Montreal,Canada
PostPosted: Wed Jan 02, 2019 6:55 am
Happy New year Guys !

can you please help with what code I would need to put in to have my lights wich are on outlet 2 of my Exp Box open then close in the morning then then re open and close in the evening

curently I have them set to go ON at 7 am and Go off at 7 pm

what I would like is to have them go ON at 7 am the shut off at 10 AM , then Go back on at 3 pm and shut off at 7 pm

thank you

below is my code

#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.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
ReefAngel.FeedingModePortsE[0] = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port7Bit;
ReefAngel.WaterChangePortsE[0] = Port5Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port4Bit;
ReefAngel.LightsOnPortsE[0] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port5Bit;
ReefAngel.OverheatShutoffPortsE[0] = Port2Bit | Port3Bit | 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( 840 );

// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
ReefAngel.Relay.On( Box1_Port5 );
ReefAngel.Relay.On( Box1_Port6 );
ReefAngel.Relay.On( Box1_Port7 );
ReefAngel.Relay.On( Box1_Port8 );

////// Place additional initialization code below here

////// Place additional initialization code above here

void loop()
ReefAngel.Relay.DelayedOn( Port3,5 );
ReefAngel.StandardLights( Port4,16,0,10,0 );
ReefAngel.StandardHeater( Port5,775,786 );
ReefAngel.StandardHeater( Port6,775,786 );
ReefAngel.StandardLights( Box1_Port1,8,0,18,0 );
ReefAngel.StandardLights( Box1_Port2,7,0,19,0 );
ReefAngel.StandardLights( Box1_Port3,10,0,15,30 );
ReefAngel.StandardLights( Box1_Port4,10,0,15,30 );
ReefAngel.PWM.SetDaylight( PWMSlope(5,0,17,0,11,60,240,11) );
ReefAngel.PWM.SetActinic( PWMSlope(5,0,17,0,0,20,240,0) );
////// Place your custom code below here

////// Place your custom code above here

// This should always be the last line
ReefAngel.Portal( "lh2o" );
ReefAngel.DDNS( "home" ); // Your DDNS is

Posts: 12391
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Wed Jan 02, 2019 11:12 am
replace this:
Code: Select all
ReefAngel.StandardLights( Box1_Port2,7,0,19,0 );

With this:
Code: Select all
if (hour(now())<12)
  ReefAngel.StandardLights( Box1_Port2,7,0,10,0 );
  ReefAngel.StandardLights( Box1_Port2,15,0,19,0 );

Posts: 35
Joined: Sun Mar 31, 2013 4:28 am
Location: Montreal,Canada
PostPosted: Sun Jan 06, 2019 4:53 am
Thak you wprks perfect !!!

Return to How do I code ...

Who is online

Users browsing this forum: Google [Bot] and 4 guests