Page 1 of 1

Delay on power up ?

Posted: Sun Jan 13, 2013 11:59 pm
by CASPAR
I am trying to set a 10min delay on a resume from power outage on my topoff port 3 on main relay box . Meaning would like for port 3 to wait 10 minutes before resuming normal operation after a power outage. This is the part of code I am talking about:

if (ReefAngel.HighATO.IsActive())
ReefAngel.SingleATO( true,Port3,60,1 );
else
ReefAngel.Relay.Off( Port3 );


I have read through the forums and seen where similar is being done with say a skimmer resuming from a power outage and / or feeding mode i.e. delayed start. Any help with how I might add just a simple delay for only this port would be highly appreciated.......

Re: Delay on power up ?

Posted: Mon Jan 14, 2013 6:13 am
by DrewPalmer04
ReefAngel.Relay.DelayedOn(Port3, 10);

This will delay port 3 for 10 min after a controller restart

Delay on power up ?

Posted: Mon Jan 14, 2013 7:53 am
by lnevo
That will not work with the ato port..

That's like having the port be On and DelayedOn at the same time..

We have some code in another thread for delaying devices after power outage that you will probably need to implement.

Re: Delay on power up ?

Posted: Mon Jan 14, 2013 8:34 am
by DrewPalmer04
Ah. Didn't understand the question. Yeah it won't work for that.

Re: Delay on power up ?

Posted: Mon Jan 14, 2013 10:08 am
by dmolton
Maybe something like this:

Code: Select all


bool atoSpanReached;  //flag to determine if the controller has been running long enough to start ATO functionality

void setup()
{
 ...
}
void loop()
{
  ...

  if(!atoSpanReached) 
  {
     if(millis() >= 600000) //Has program been running for 10 minutes?
       atoSpanReached = true;  //It has so the set the flag
  }
  if(atoSpanReached) //Only run the ATO operations if the flag has been set
  {
     if (ReefAngel.HighATO.IsActive())
        ReefAngel.SingleATO( true,Port3,60,1 );
     else
        ReefAngel.Relay.Off( Port3 );
  }
}