New Setup, Need Help w/RF

Do you have a question on how to do something.
Ask in here.

Posts: 11973
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Fri Nov 25, 2016 2:12 pm
When set to false, you won't be able to control with app.
That's why the code is set to true on other times than the ones you want to override through code.
Roberto.

Posts: 75
Joined: Mon Oct 31, 2016 12:33 pm
PostPosted: Sat Nov 26, 2016 6:25 am
Just so I'm on the right track, the code below is;
Memory set to true, use app (or memory) settings
Set to false between the hours of 3pm and 5pm; mode set to longwave 100%, 3 seconds
Set to false between the hours of 10pm and 7pm; mode set to reefcrest 40%, 0 seconds

3 questions;
1.) am I on the right track
2.) what does setting the duration to "0" do
3.) why in the app is there "home" and "away"; ie, what's the difference?



Code: Select all

void loop()
{
    ReefAngel.StandardHeater( Port1 );
    ReefAngel.RF.UseMemory = true;
   
    ////// Place your custom code below here
   
    if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
  {
    if (hour()>=15 && hour()<=17) ////WHAT DO #'s MEAN?
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(LongWave,100,3);  ////Can I change this to any mode?
    }
    else if (hour()>=22 || hour()<7) ////WHAT DO #'s MEAN?
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(ReefCrest,40,0); ////WHAT DO #'s MEAN?
    }
    else
    {
      ReefAngel.RF.UseMemory=true; ////Does this need to be here at the end?
    }

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


}
Image

Posts: 11973
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sat Nov 26, 2016 4:39 pm
I think you are good.
Duration is how long between changes.
Home and away is for different profiles.
You may have internet that blocks incoming from inside you own network. I do. So I have to setup a home with internal ip and away with external IP.
Roberto.

Posts: 75
Joined: Mon Oct 31, 2016 12:33 pm
PostPosted: Sat Nov 26, 2016 4:49 pm
rimai wrote:I think you are good.
Duration is how long between changes.
Home and away is for different profiles.
You may have internet that blocks incoming from inside you own network. I do. So I have to setup a home with internal ip and away with external IP.


I see. Both home and away that I have set work weather I'm on my network or not. I have my external ip set for both.
Image

Posts: 11973
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sat Nov 26, 2016 5:19 pm
lucky u :)
Roberto.

Posts: 75
Joined: Mon Oct 31, 2016 12:33 pm
PostPosted: Sun Nov 27, 2016 8:35 am
I'm still haveing a bit of trouble understanding. What does this line do?

Code: Select all
if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)


and especially in conjunction with this;

Code: Select all
if (hour()>=15 && hour()<=17) //----------Between 3pm and 5 pm


Original code (the only thing I've changed is the comments);

Code: Select all
void loop()
{
    ReefAngel.StandardHeater( Port1 );
    ReefAngel.RF.UseMemory = true;
   
    ////// Place your custom code below here
   
    if (ReefAngel.DisplayedMenu!=FEEDING_MODE || ReefAngel.DisplayedMenu!=WATERCHANGE_MODE)
    {
    if (hour()>=15 && hour()<=17) //----------Between 3pm and 5 pm
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(LongWave,100,3); //----------LongWave, 100%, 3 seconds
    }
    else if (hour()>=22 || hour()<7) //----------Between 10pm and 7am
    {
      ReefAngel.RF.UseMemory=false;
      ReefAngel.RF.SetMode(ReefCrest,40,0); //----------ReefCrest, 40%, 0ms
    }
    else
    {
      ReefAngel.RF.UseMemory=true; //----------Return to default settings
    }


Edit: I think I get it. If in Feeding Mode OR Water Change Mode switch to these settings if between 3pm-5pm, 10pm-7am

What I don't understand is the && or ||. I know what they mean(&& is for both be true, || is for either be true) but I don't understand the logic here. Couldn't the "||" in this line be a "&&" or vice versa?
Code: Select all
else if (hour()>=22 || hour()<7)


Edit 2: I think it's because everything starts over at 12am. So it would be only true if after 10pm OR before 7am because the code starts over at 12am and both instances can not be true.

Funny, I'm not going to use this code, I just wanted to dissect it to understand it. If someone could confirm all my ramblings, I'd appreciate it. Thanks!! :D
Image

Posts: 11973
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Nov 27, 2016 11:38 am
You got it.
!= means NOT
&& means AND
|| means OR
Roberto.
Previous

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 2 guests