Dimmable lunar hub

Expansion modules and attachments
Post Reply
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Dimmable lunar hub

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

Re: Dimmable lunar hub

Post 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.
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: Dimmable lunar hub

Post 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?
Last edited by davaraj on Sun Nov 17, 2013 8:17 am, edited 1 time in total.
Image
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Dimmable lunar hub

Post by lnevo »

Yep, thats the other way to do it...
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: Dimmable lunar hub

Post by davaraj »

Thanks.

The light came on at 10 pm. Hope it goes off at 8 am
Image
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: Dimmable lunar hub

Post by davaraj »

The lunar lights went off at 8am. The code works!
Image
ishtak
Posts: 41
Joined: Wed Apr 25, 2012 3:50 am
Location: JHB, South Africa

Re: Dimmable lunar hub

Post 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?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dimmable lunar hub

Post by rimai »

You can connect it to the standard dimming ports on the relay box, or any unused channel in your dimming module.
Roberto.
ishtak
Posts: 41
Joined: Wed Apr 25, 2012 3:50 am
Location: JHB, South Africa

Re: Dimmable lunar hub

Post 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
Image
Post Reply