Page 1 of 1

Dimming past midnight and 2 dimming codes

PostPosted: Wed Mar 22, 2017 8:10 am
by GugsJr
I'm trying to get my lights to do two things.

1. End dimming to stop at 10% while in the memory. Currently it goes down to 0%\
2. After the first schedule ends to start a second dimming schedule that will go past midnight.

Dimming Channel 2
At 2:30 lights come at at 1%, then Dim down to 5% at 11:30. From 11:30pm to 2:30am to go from 5% to 0%
Dimming Channel 4
At 3:00 lights come at at 1%, then Dim down to 5% at Midnight. From Midnight to 3:00am to go from 5% to 0%

This is what I came up with and it kind of works but doesn't really work the way I intended. They actually turned off around 1am this morning. I'm guessing it's because I have it as a parabola. I'm think a slope might work better for that.

I'm trying to keep everything in the memory so I can change it on the fly if my work schedule changes.

Code: Select all

//Lights Schedule

if (now()%SECS_PER_DAY<0|| now()%SECS_PER_DAY >=52200) { // Time is before Midnight and after 2:30pm
    ReefAngel.PWM.Channel1PWMParabola(); //Front Whites 4:00pm-10:00pm
    ReefAngel.PWM.Channel2PWMParabola(90); //Back Blues 2:30pm-11:30pm
    ReefAngel.PWM.Channel3PWMParabola(-30,30); //Back Whites 4:30pm-10:30pm
    ReefAngel.PWM.Channel4PWMParabola(120); //Back Blues 3:00pm-12:00AM

} else if (now()%SECS_PER_DAY<10800|| now()%SECS_PER_DAY >=0) { // Time is before 3:00am and after Midnight
    ReefAngel.PWM.SetChannel( 2,PWMParabola( 0,1,3,0,1,5,0 ) );
    ReefAngel.PWM.SetChannel( 4,PWMParabola( 0,1,3,30,1,5,0 ) );