Multiple scheduled outlet times

Do you have a question on how to do something.
Ask in here.
Post Reply
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple scheduled outlet times

Post 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 }
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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);
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple scheduled outlet times

Post by lnevo »

Yes and yes
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple scheduled outlet times

Post 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 
  }
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple scheduled outlet times

Post by lnevo »

They should show up once activated. If you don't already have a relay expansion, it should be Box1 rather than Box2.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple scheduled outlet times

Post by lnevo »

Reference it in the code, then compile and upload and it should be recognized.
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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...
Image
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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?
Image
Spotted
Posts: 101
Joined: Thu May 10, 2012 5:46 am
Location: Sunny (and hot) South Florida

Re: Multiple scheduled outlet times

Post 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?
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Multiple scheduled outlet times

Post by lnevo »

Yes
Post Reply