Off set my Daylight and Actinics?

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

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Mon Mar 13, 2017 8:50 am
So I have my code in the memory but I want to offset my Actinics and Daylights.

***I want to Offset my LED fixtures by an hour of each other.
***I don't want my moonlights to be opposite of my daylights.
***Also I want my refugium to lights to stay on for 30 minutes after my Daylights come on and Go on 30 before my daylights go off.

I know I'd need an offset command but I'm not sure exactly what the command would be.

Here is my current 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] = Port2Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port6Bit;
ReefAngel.WaterChangePortsE[0] = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
ReefAngel.LightsOnPortsE[0] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port5Bit;
ReefAngel.OverheatShutoffPortsE[0] = Port3Bit | Port5Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;


// Ports that are always on
ReefAngel.Relay.On( Port6 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port2 );
ReefAngel.Relay.On( Box1_Port8 );

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


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

void loop()
{
ReefAngel.ActinicLights( Port1 );
ReefAngel.ActinicLights( Port2 );
ReefAngel.DayLights( Port3 );
ReefAngel.DayLights( Port4 );
ReefAngel.StandardHeater( Port5 );
ReefAngel.StandardHeater( Box1_Port3 );
ReefAngel.StandardHeater( Box1_Port5 );
ReefAngel.StandardATO( Box1_Port6 );
ReefAngel.MoonLights( Box1_Port7 );
ReefAngel.PWM.Channel1PWMParabola();
ReefAngel.PWM.Channel2PWMParabola();
ReefAngel.PWM.Channel3PWMParabola();
ReefAngel.PWM.Channel4PWMParabola();
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
ReefAngel.DCPump.ExpansionChannel[0] = Sync;
ReefAngel.DCPump.ExpansionChannel[1] = None;
ReefAngel.DCPump.ExpansionChannel[2] = None;
ReefAngel.DCPump.ExpansionChannel[3] = None;
ReefAngel.DCPump.ExpansionChannel[4] = None;
ReefAngel.DCPump.ExpansionChannel[5] = None;
////// Place your custom code below here


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

// This should always be the last line
Last edited by GugsJr on Mon Mar 13, 2017 7:41 pm, edited 2 times in total.

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Mon Mar 13, 2017 5:14 pm
Does this look right?

ReefAngel.ActinicLights( Port1, InternalMemory.ActinicLights_read(-10,70) ); // Off set 10 minutes before start time but an hour and 10 minutes after end time


ReefAngel.ActinicLights( Port2, InternalMemory.ActinicLights_read(0,240) ); // Offset 4 hours after end time

ReefAngel.DayLights( Port3, InternalMemory.DayLights_read(420,240) ); // Off set Daylight 7 Hours after start and 4 hours after end

ReefAngel.DayLights( Port4, InternalMemory.ActinicLights_read(480,300) ); // Off set Daylight 8 hours after start and 5 hours after end

ReefAngel.MoonLights( Box1_Port7, InternalMemory.Moonlights_read(-30,30) ); // Off set by 30 minutes after start and before end ( of Moonlight )

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Mon Mar 13, 2017 7:36 pm
Didn't work. I got this

sketch_mar13a.cpp: In function 'void loop()':
sketch_mar13a:80: error: 'class InternalEEPROMClass' has no member named 'ActinicLights_read'
sketch_mar13a:81: error: 'class InternalEEPROMClass' has no member named 'ActinicLights_read'
sketch_mar13a:82: error: 'class InternalEEPROMClass' has no member named 'DayLights_read'
sketch_mar13a:83: error: 'class InternalEEPROMClass' has no member named 'ActinicLights_read'
sketch_mar13a:88: error: 'class InternalEEPROMClass' has no member named 'Moonlights_read'
User avatar
Posts: 5343
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Tue Mar 14, 2017 8:05 am
Read just takes a memory location. Not sure why you have 2 arguments there?

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Tue Mar 14, 2017 8:11 am
lnevo wrote:Read just takes a memory location. Not sure why you have 2 arguments there?


I'm trying to offset the start time and end time
User avatar
Posts: 5343
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Mon Mar 20, 2017 3:31 pm
Offset is one argument that affects both start and end equally. If you want to do granular you'll need to pass every argument to the Lights() functions. But InternalMemory.read() only takes one argument which is the memory location that you want to read. Also your time for before and after is the same so you should just use the one arg for offset it already does +/- unless you want it to start early and end early (default is start early, end late) or vice-versa. Sorry if its confusing. I'll post some better sample code once I know what your trying to do better

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Mon Mar 20, 2017 9:18 pm
This is what I have currently. I'm trying to get it so when I change something in the portal or the app it changes the lights for all of them. That way if my work schedule changes I just can do it quickly without having to go back and upload the code.

I'm assuming this is starting from the daylight on off time of On at 4pm and off at 10pm

ReefAngel.PWM.Channel1PWMParabola(); //Front Whites 4:00pm-10:00pm
ReefAngel.PWM.Channel2PWMParabola(90); //Back Blues 2:30pm-11:30pm
ReefAngel.PWM.Channel3PWMParabola(30); //Back Whites 4:30pm-10:30pm
ReefAngel.PWM.Channel4PWMParabola(120); //Back Blues 3:00pm-12:00AM

Posts: 68
Joined: Fri Jun 20, 2014 6:30 am
PostPosted: Tue Mar 21, 2017 1:39 pm
Actually it is working. I had a different part of my code that was conflicting with this one.

This is the code that is actually working. I think I'll post my conflicting code into its own thread. Than you for your help.

Code: Select all
ReefAngel.PWM.Channel1PWMParabola(); //Front Whites 4:00pm-10:00pm
    ReefAngel.PWM.Channel2PWMParabola(90); //Back Blues 2:30pm-11:30pm
    ReefAngel.PWM.Channel3PWMParabola(-30,30); //Back Whites 4:30pm-10:30pm
    ReefAngel.PWM.Channel4PWMParabola(120); //Back Blues 3:00pm-12:00AM

Return to How do I code ...

Who is online

Users browsing this forum: Google [Bot] and 1 guest