on\off by time

Do you have a question on how to do something.
Ask in here.
Post Reply
Decatur5717
Posts: 9
Joined: Sat Apr 26, 2014 2:28 pm

on\off by time

Post by Decatur5717 »

I've been running around looking for a code that will work for my setup by sadly nothing has worked. In the near future I will have 4 different light channels in my hood and I need... or want... to turn them on and off at certain times according to where they are located on the power strip.

For now however I only have a single power connection running to the tank and therefore can only control 1 of the 4 channels (I ran out off spare extension cables).

At the moment I have a Par38 bulb plugged directly to port8 on the power strip. My problem is, how do I turn this port off every night at 8 and back on at 7? Here is what I have now (new code is at the bottom)

#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.AddStandardMenu(); // Add Standard Menu

ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port5Bit | 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( 815 );


// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port7 );

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


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

void loop()
{
ReefAngel.StandardHeater( Port5,790,795 );
////// Place your custom code below here
if ( ( (hour()==7) && (minute()==30) ))
ReefAngel.Relay.On(Port8);
if ( ( (hour()==20) && (minute()==0) ))
ReefAngel.Relay.off(Port8);

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

// This should always be the last line
ReefAngel.ShowInterface();
}
Decatur5717
Posts: 9
Joined: Sat Apr 26, 2014 2:28 pm

Re: on\off by time

Post by Decatur5717 »

Hey look at that ... Found a good example Will test it out here in a bit

#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.AddStandardMenu(); // Add Standard Menu

ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port8Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port5Bit | 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( 815 );


// Ports that are always on
ReefAngel.Relay.On( Port1 );

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


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

void loop()
{
ReefAngel.StandardHeater( Port5,790,795 );
ReefAngel.StandardLights( Port7,11,0,6,0 );
ReefAngel.StandardLights( Port8,7,30,20,0 );
////// Place your custom code below here


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

// This should always be the last line
ReefAngel.ShowInterface();
}
Decatur5717
Posts: 9
Joined: Sat Apr 26, 2014 2:28 pm

Re: on\off by time

Post by Decatur5717 »

I suppose I was making it too complicated :)

This alone fixed it

ReefAngel.StandardLights( Port8,7,0,20,0 );
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: on\off by time

Post by rimai »

Yeap :)
Roberto.
Post Reply