Page 1 of 1

Re: Multiple scheduled outlet times

Posted: Thu Oct 08, 2015 8:26 pm
by Spotted
The other way with the else statement would look like this?

Code: Select all

 
    if (now()%3600<900)
    { //Every 60 minutes
    ReefAngel.Relay.On(Box1_Port3); 
    }
    } else {
    ReefAngel.Relay.Off(Box1_Port3); 
    }
I'm trying to learn how to properly use the if/else statement.

Re: Multiple scheduled outlet times

Posted: Thu Oct 08, 2015 8:58 pm
by lnevo
Like this:

Code: Select all

 
    if (now()%3600<900)
    { //Every 60 minutes
    ReefAngel.Relay.On(Box1_Port3); 
    } else {
    ReefAngel.Relay.Off(Box1_Port3); 
    }
you had an extra }

Re: Multiple scheduled outlet times

Posted: Fri Oct 09, 2015 5:38 am
by Spotted
Yes
I see it, the line above the else line right?

So how about this? This looks a lot less complicated than the if else argument,.
Spotted wrote:So replace all of this

Code: Select all

 
    if (now()%3600<900)
    { //Every 60 minutes
    ReefAngel.Relay.On(Box1_Port3); // Turn on Aqualifter for 15 minutes
    }
with this?

Code: Select all

ReefAngel.Relay.Set(Box1_Port3, now()%3600<900);

Re: Multiple scheduled outlet times

Posted: Fri Oct 09, 2015 10:16 am
by lnevo
Yes and yes

Re: Multiple scheduled outlet times

Posted: Sat Oct 10, 2015 4:33 am
by Spotted
I'm happy, my code is coming along.
Next project. Is there a way to get the power heads to go into Nutrient Transport mode after a feeding?
Can I modify this to work?

Code: Select all

    if ((now()%SECS_PER_DAY==31320)) //if it is 8:42 AM
    {ReefAngel.FeedingModeStart();}
Just change the times to coincide with the automated feeding?

Re: Multiple scheduled outlet times

Posted: Sat Oct 10, 2015 8:54 am
by lnevo
If you're good at reading code you should try and look through my INO. I know mine is a bit complex so I'll try and simplify the request here for you:

Code: Select all

  int ntmDelay=300; // Time to wait before starting Nutrient Transport
  int ntmTime=7200; // Time to run Nutrient Transport
  static time_t t;

  if (now()-t > ntmDelay && now()-t < ntmTime+ntmDelay) {
    ReefAngel.DCPump.Mode=NutrientTransport; 
  }
  
  if (ReefAngel.DisplayedMenu==FEEDING_MODE) {
    t=now(); // Run post feeding mode when this counter stops 
  }

Re: Multiple scheduled outlet times

Posted: Sun Oct 11, 2015 6:21 pm
by Spotted
Ok, I don't think I'm going to use the NT mode after feeding. I might schedule it at a certain time of the day instead.
I have another request. I have the 12V power thingy I want to use to run a couple of water solenoid valves. I understand that it shows up as another relay box. I understand that I need to write it in the code as follows to turn ports on and off.

ReefAngel.Relay.On(Box2_Port3);

Thing is I will only be using them right now as manual ports to refill my ATO reservoir and water change barrels. How do I make them accessible in the app?

Re: Multiple scheduled outlet times

Posted: Sun Oct 11, 2015 9:10 pm
by lnevo
They should show up once activated. If you don't already have a relay expansion, it should be Box1 rather than Box2.

Re: Multiple scheduled outlet times

Posted: Mon Oct 12, 2015 3:18 am
by Spotted
I do have another relay. I have 2 regular relay boxes and then the 12 volt power expansion. How would I activate it? Just plug it in to the system and it adds another set of relays in the app?

Re: Multiple scheduled outlet times

Posted: Mon Oct 12, 2015 5:09 am
by lnevo
Reference it in the code, then compile and upload and it should be recognized.

Re: Multiple scheduled outlet times

Posted: Mon Oct 12, 2015 9:23 am
by Spotted
I'm sorry, I am not sure how to reference it in the code. I'm not a coder. I'm a home theater installer.. Sorry...

Re: Multiple scheduled outlet times

Posted: Mon Oct 12, 2015 9:34 am
by Spotted
Actually I think I understand. I could just reference them as off in the code and then I will get the ability to control them in the app right? Something like this?

Code: Select all

ReefAngel.Relay.Off(Box3_Port1);
ReefAngel.Relay.Off(Box3_Port2);
Is this right?

Re: Multiple scheduled outlet times

Posted: Mon Oct 12, 2015 10:39 am
by Spotted
No, It should be

Code: Select all

ReefAngel.Relay.Off(Box2_Port1);
ReefAngel.Relay.Off(Box2_Port2);
Box2 not Box3, yes?

I got a Main Relay (Box), Expansion Relay(Box1), and the Power Control Module(Box2)

Yes?

Re: Multiple scheduled outlet times

Posted: Mon Oct 12, 2015 11:41 am
by lnevo
Yes