Page 1 of 1

Dimmable lunar hub

Posted: Sun Nov 17, 2013 5:30 am
by davaraj
I have the dimmable lunar hub connected to channel 0 of the dimming expansion unit.
This is the code I have for the lunar lights to come on at 10 pm and go off at 8 am.

if (hour()>=22 && hour()<8) // Turn Moonlights on/off
{
ReefAngel.PWM.SetChannel( 0, MoonPhase());
} else
{
ReefAngel.PWM.SetChannel( 0, 0 );
}

Will this code work?

Re: Dimmable lunar hub

Posted: Sun Nov 17, 2013 6:41 am
by lnevo
No it wont. You cant have a logic statement where the hour is greater than 22 AND less than 8. Change the && to || and it will become a logical OR statement instead. So the statement would say if the hour is greater than 22 or if its less than 8.

Re: Dimmable lunar hub

Posted: Sun Nov 17, 2013 7:43 am
by davaraj
lnevo wrote:No it wont. You cant have a logic statement where the hour is greater than 22 AND less than 8. Change the && to || and it will become a logical OR statement instead. So the statement would say if the hour is greater than 22 or if its less than 8.
I have changed the code to this:

if (hour()>=8 && hour()<22) // Turn Moonlights on/off
{
ReefAngel.PWM.SetChannel( 0, (0));
}
else
{
ReefAngel.PWM.SetChannel( 0, MoonPhase());
}

Will this code work now?

Re: Dimmable lunar hub

Posted: Sun Nov 17, 2013 8:17 am
by lnevo
Yep, thats the other way to do it...

Re: Dimmable lunar hub

Posted: Sun Nov 17, 2013 8:19 am
by davaraj
Thanks.

The light came on at 10 pm. Hope it goes off at 8 am

Re: Dimmable lunar hub

Posted: Sun Nov 17, 2013 7:00 pm
by davaraj
The lunar lights went off at 8am. The code works!

Re: Dimmable lunar hub

Posted: Thu Nov 28, 2013 2:43 am
by ishtak
Hey guys,

I have a question around the wiring of the hub. I have LEDS connected to ports 0,1,2 and 3 on my Dimmable Expansion Module. Am I correct in thinking I can connect the Moonhub to port 4?

Re: Dimmable lunar hub

Posted: Thu Nov 28, 2013 9:48 am
by rimai
You can connect it to the standard dimming ports on the relay box, or any unused channel in your dimming module.

Re: Dimmable lunar hub

Posted: Thu Nov 28, 2013 12:24 pm
by ishtak
Thanks Roberto .. thats what I was hoping for. I'll be using the dimming ports on the relay box to connect my 2 Jebao WP25's .. so port 4 on the dimming module it is .. now to place an order with Reef Angel SA :D