The original code looked something like this:
Code: Select all
if (hour()>=10 && hour()<21)
{
ReefAngel.PWM.SetDaylight(ReefCrestMode(50,50,true));
}
else if (hour()>=9 && hour()<22)
{
ReefAngel.PWM.SetDaylight(ReefCrestMode(25,16,true));
}
else
{
ReefAngel.PWM.SetDaylight(ReefCrestMode(0,0,true));
}
I've put it into multiple lines so you can see the arguments more clearly.
Code: Select all
ReefAngel.PWM.SetDaylight(
ReefCrestMode(
PWMSlope(9,0,22,0,25,50,60,0),
PWMSlope (9,0,22,0,16,50,60,0),
true
)
);
Code: Select all
ReefAngel.PWM.SetDaylight(ReefCrestMode(PWMSlope(9,0,22,0,25,50,60,0),PWMSlope (9,0,22,0,16,50,60,0),true));
Except now, instead of static numbers for the 2 numeric arguments to ReefCrestMode, we've replaced them with the PWMSlope. Here are the arguments to PWMSlope. So what I did was say from 9am to 10pm we will go from 25% to 50% and it will take 60 minutes to get there. Otherwise we will use 0. So that last 0 is your last else. You could set it tthat last argument for whatever you want for your night mode to be.
Here's the definition for the PWMSlope command.
byte PWMSlope (
byte startHour,
byte startMinute,
byte endHour,
byte endMinute,
byte startPWM,
byte endPWM,
byte Duration,
byte oldValue
)
You could also do the same thing using the PWMParabola as well. The function is pretty much the same, just without the duration argument.
byte PWMParabola (
byte startHour,
byte startMinute,
byte endHour,
byte endMinute,
byte startPWM,
byte endPWM,
byte oldValue
)