Page 1 of 1

Wavemaker off at night

Posted: Tue Jul 03, 2012 7:46 pm
by DrewPalmer04
I'm trying my best...but this doesn't work..but compiles at least

Code: Select all

if ( (hour()>=7 || hour()<20))
    {
    ReefAngel.WavemakerRandom(Port5,25,60);
 // Turn Port5 on/off random cycles that lasts from 25 to 60 secs
    ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
 // Turn Port6 on/off on opposite cycle as Port 5
    }
    else
    {
    ReefAngel.Relay.Off(Port5);
    ReefAngel.Relay.Off(Port6);
    } //Wavemaker on from 0700 to 2000, Off there after
Fix?

Re: Wavemaker off at night

Posted: Tue Jul 03, 2012 7:49 pm
by binder
Use this instead

Code: Select all

if ( (hour()>=7 && hour()<20))
You were saying OR and this says AND. This code reads when the hour is between 7 and 20.
It was saying if the hour is greater than 7 OR if the hour is less than 20. Both of those scenarios would always have been true.

Re: Wavemaker off at night

Posted: Tue Jul 03, 2012 7:52 pm
by DrewPalmer04
Thanks!!! Dang that was my next guess :(

Re: Wavemaker off at night

Posted: Wed Jul 04, 2012 5:24 am
by binder
DrewPalmer04 wrote:Thanks!!! Dang that was my next guess :(
No worries. It's usually the simple things that get us. And believe me, I've made plenty of those simple mistakes myself. :)