Relay outlet port

Basic / Standard Reef Angel hardware
Post Reply
Rey
Posts: 36
Joined: Wed Sep 07, 2011 7:56 pm

Relay outlet port

Post 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);
}

Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay outlet port

Post by rimai »

From what time to what time?
Roberto.
Rey
Posts: 36
Joined: Wed Sep 07, 2011 7:56 pm

Re: Relay outlet port

Post by Rey »

on from 7am to 11pm
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay outlet port

Post 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?
Roberto.
Rey
Posts: 36
Joined: Wed Sep 07, 2011 7:56 pm

Re: Relay outlet port

Post by Rey »

so even if i already have standardlights in my code this will not conflict with each other?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Relay outlet port

Post by rimai »

Nope :)
You can have all 8 ports using StandardLights() function
Roberto.
Rey
Posts: 36
Joined: Wed Sep 07, 2011 7:56 pm

Re: Relay outlet port

Post by Rey »

awesome. Thanks roberto..
Image
binder
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: Relay outlet port

Post 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
Post Reply