delayed start code

Do you have a question on how to do something.
Ask in here.
Post Reply
emict326
Posts: 48
Joined: Thu Mar 15, 2012 8:29 am
Location: Middleburg FL

delayed start code

Post by emict326 »

how do i set to have port 6 be able to come on only after 30min if port 7 has run. port 7 is a power head stirring kalckwash and port 6 is the ato pump using that water
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: delayed start code

Post by rimai »

How often do you stir?
Roberto.
emict326
Posts: 48
Joined: Thu Mar 15, 2012 8:29 am
Location: Middleburg FL

Re: delayed start code

Post by emict326 »

every 240min for 15sec. i have it set up as a dosing pump via the RA wizard
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: delayed start code

Post by rimai »

Try this:

Code: Select all

ReefAngel.DosingPumpRepeat(Port7,0,240,15);
ReefAngel.DosingPumpRepeat(Port6,30,240,15);
Roberto.
emict326
Posts: 48
Joined: Thu Mar 15, 2012 8:29 am
Location: Middleburg FL

Re: delayed start code

Post by emict326 »

OK i know that you are very busy but could you pleas explain to me what the numbers in there potions mean. i would like to learn why vs just having it given to me so i do not have to bother you next time
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: delayed start code

Post by rimai »

No problem.
Here are the parameters for this function:
http://www.easte.net/RA/html/class_reef ... 1a7dee9cbe
The first parameter is the port.
The second parameter is the offset
The third parameter is the total cycle
The forth parameter is the runtime
So, The first line will turn port 7 for 15s every 240minutes with zero offset. So it will be on the dot of every 240minutes
The 2nd line is the same thing for port6, but with a 30minute offset. So it is actually lagging by 30minutes compared to the 1st line.
I hope it was clear.
Roberto.
emict326
Posts: 48
Joined: Thu Mar 15, 2012 8:29 am
Location: Middleburg FL

Re: delayed start code

Post by emict326 »

OK so port 6 is my ato pump controlled by a single low float switch. what i am wanting is for the ATO not to be able to be activated for 30min after my calk stir goes off to give the slurry time to settle. I am not sure that the code above will achieve that, but from what you just taught me will the code below work? or will the single ATO never activate. and how does it know if you are talking about sec, or min? also i have the setings saved in memory not code if that matters

ReefAngel.DosingPumpRepeat(Port7,0,240,15);
ReefAngel.SingleATOLow(Port6,30,240,0);
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: delayed start code

Post by rimai »

Oh... now I understand what you are trying to do.
Those parameters will only work on the DosingPumpRepeat() function.
The SingleATOLow() has a different set of parameters. In fact, the only parameter is the port number.
It's meant to use internal memory settings.
http://www.easte.net/RA/html/class_reef ... dbe9f32eb8
For what you are trying to do, you need to do something like this:

Code: Select all

ReefAngel.DosingPumpRepeat(Port7,0,240,15);
if (now()%(240*60)<(30*60)) 
  ReefAngel.Relay.Off(Port6);
else
  ReefAngel.SingleATO(true,Port6,60,0);
This code is checking if it should run ATO function or turn off the relay port.
Give it a shot.
Roberto.
emict326
Posts: 48
Joined: Thu Mar 15, 2012 8:29 am
Location: Middleburg FL

Re: delayed start code

Post by emict326 »

#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 <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();
ReefAngel.AddDateTimeMenu();
ReefAngel.FeedingModePorts = Port1Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port5Bit | Port6Bit | Port7Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;


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

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


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

void loop()
{
ReefAngel.StandardHeater( Port2 );
ReefAngel.ActinicLights( Port3 );
ReefAngel.DayLights( Port4 );
ReefAngel.SingleATOLow( Port6);
ReefAngel.DosingPump( Port7,0,240,15);
////// Place your custom code below here
if (ReefAngel.LowATO.IsActive()) ReefAngel.Relay.Off(Port7);
ReefAngel.DosingPumpRepeat(Port7,0,240,15);
if (now()%(240*60)<(30*60)
)ReefAngel.Relay.Off(Port6);
else
ReefAngel.SingleATO(true,Port6,60,0);

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


// This should always be the last line
ReefAngel.Portal( "emict326" );
ReefAngel.ShowInterface();
}

here is my whole code
Now i Get a Compiling error
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: delayed start code

Post by rimai »

Sorry, I missed one parenthesis....

Code: Select all

#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 <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();
  ReefAngel.AddDateTimeMenu();
  ReefAngel.FeedingModePorts = Port1Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port5Bit | Port6Bit | Port7Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit;
  // Use T1 probe as temperature and overheat functions
  ReefAngel.TempProbe = T1_PROBE;
  ReefAngel.OverheatProbe = T1_PROBE;


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

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


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

void loop()
{
  ReefAngel.StandardHeater( Port2 );
  ReefAngel.ActinicLights( Port3 );
  ReefAngel.DayLights( Port4 );
  ////// Place your custom code below here
  ReefAngel.DosingPumpRepeat(Port7,0,240,15);
  if (ReefAngel.LowATO.IsActive()) ReefAngel.Relay.Off(Port7);
  if (now()%(240*60)<(30*60))
    ReefAngel.Relay.Off(Port6);
  else
    ReefAngel.SingleATO(true,Port6,60,0);

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


  // This should always be the last line
  ReefAngel.Portal( "emict326" );
  ReefAngel.ShowInterface();
}

Roberto.
Post Reply