Page 1 of 1

Relay outlet port

Posted: Fri Oct 21, 2011 3:47 pm
by Rey
My port 8 is set to always on. How do i set it up so that it's ON 16 hours a day? Below is my code.

Code: Select all

// Autogenerated file by RAGen (v1.0.4.92), (09/09/2011 09:18)
// RA_090911_0918.pde
//
// This version designed for v0.8.5 Beta 12 or later

/* The following features are enabled for this PDE File: 
 #define DisplayImages
 #define WavemakerSetup
 #define DateTimeSetup
 #define VersionMenu
 #define ATOSetup
 #define MetalHalideSetup
 #define DirectTempSensor
 #define DisplayLEDPWM
 #define StandardLightSetup
 */

#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>


void setup()
{
  ReefAngel.Init();  //Initialize controller

  ReefAngel.FeedingModePorts = B00001100;
  ReefAngel.WaterChangePorts = B00001100;
  ReefAngel.OverheatShutoffPorts = B00011111;
  ReefAngel.LightsOnPorts = B00000011;

  // Ports that are always on
  ReefAngel.Relay.On(Port8);
  // Random value from 60seconds to whatever is stored in internal memory
  ReefAngel.Timer[1].SetInterval(random(5, InternalMemory.WM1Timer_read()));
  ReefAngel.Timer[1].Start();
  ReefAngel.Relay.On(Port3);
}

void loop()
{
  ReefAngel.ShowInterface();

  // Specific functions
  ReefAngel.MHLights(Port1);
  ReefAngel.StandardLights(Port2);
  if ( ReefAngel.Timer[1].IsTriggered() )
  {
    // Random value from 60seconds to whatever is stored in internal memory
    ReefAngel.Timer[1].SetInterval(random(5, InternalMemory.WM1Timer_read()));
    ReefAngel.Timer[1].Start();
    ReefAngel.Relay.Toggle(Port3);
    ReefAngel.Relay.Toggle(Port4);
  }
  ReefAngel.StandardHeater(Port5);
  ReefAngel.StandardFan(Port6);
  ReefAngel.StandardATO(Port7);
}


Re: Relay outlet port

Posted: Fri Oct 21, 2011 3:49 pm
by rimai
From what time to what time?

Re: Relay outlet port

Posted: Fri Oct 21, 2011 3:52 pm
by Rey
on from 7am to 11pm

Re: Relay outlet port

Posted: Fri Oct 21, 2011 3:54 pm
by rimai

Code: Select all

  ReefAngel.StandardLights(Port8,7,0,23,0);
Just because it says Lights, doesn't mean it has to be used only for lights :)
Would that work for you?

Re: Relay outlet port

Posted: Fri Oct 21, 2011 3:56 pm
by Rey
so even if i already have standardlights in my code this will not conflict with each other?

Re: Relay outlet port

Posted: Fri Oct 21, 2011 3:57 pm
by rimai
Nope :)
You can have all 8 ports using StandardLights() function

Re: Relay outlet port

Posted: Fri Oct 21, 2011 3:58 pm
by Rey
awesome. Thanks roberto..

Re: Relay outlet port

Posted: Fri Oct 21, 2011 5:46 pm
by binder
Rey wrote:so even if i already have standardlights in my code this will not conflict with each other?
Just make sure you use the long version of the StandardLights function. There are 2 versions of it:
  • Short Version - StandardLights(Port) that uses the internal memory values for the on & off times
  • Long Version - StandardLights(Port, on hour, on minute, off hour, off minute) that uses the values passed in
The short version actually calls the long version using the default internal memory locations for the Standard Lights. Probably more information than what you wanted, but I figured I would clarify things a little more.

curt