Moonphase calculation

Related to the development libraries, released by Curt Binder
Post Reply
jemw
Posts: 41
Joined: Sat Oct 08, 2011 9:21 am

Re: Moonphase calculation

Post by jemw »

I have found that this statement does not work as expected:
if (hour()>22 && hour()<9)
{
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.PWM.SetDaylight(MoonPhase());
}

My moonlights were on all the time.

To make my moonlights turn on at 7PM and turn off at 7AM I found:

Added this code to the setup to turn them off by default (power failure etc.):
// Set Actinic and Daylight off by default
ReefAngel.PWM.SetActinic(0);
ReefAngel.PWM.SetDaylight(0);

And then added this code to the loop function:
if ( hour() <= 6 || hour () >= 19 ) // Moonlights on from 7PM to 7AM
{
ReefAngel.PWM.SetActinic(MoonPhase());
ReefAngel.PWM.SetDaylight(MoonPhase());
}
else
{
ReefAngel.PWM.SetActinic(0);
ReefAngel.PWM.SetDaylight(0);

}
_____
Jim
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Moonphase calculation

Post by rimai »

Yes, it was a typo that I made. I fixed it on my previous post too.
Thanks for your help!!! :)
Roberto.
Post Reply