Page 1 of 1

PWM Slope Code

Posted: Sat Jul 26, 2014 10:39 pm
by Tranquil201
Does this code look correct?

Daylights on a 2:00PM ramp up from 15%-60% over 60 minutes. Then ramp down from 60% to 15% and turn off at 10:30PM to 0%

Actinics on at 1:30PM ramp up from 15%-80% over 60 minutes. Then ramp down from 80% to 15% but turn off at 11:00PM to 0%

ReefAngel.PWM.SetDaylight( PWMSlope(14,0,22,30,15,60,60,0) );
ReefAngel.PWM.SetActinic( PWMSlope(13,30,23,0,15,80,60,0) );

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 2:56 am
by cosmith71
I believe so. I'm not completely up on that last 0 in the PWMSlope function but I think that's what it does.

If not, there are other ways to get you to zero.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 4:11 am
by Sacohen
This is what Roberto gave me for my moonlights

Which are off between 1pm and 9pm and ramp from 0 to whatever % the Moonphase is that night.

Code: Select all

  if ( hour()>=13 && hour()<21 )
  ReefAngel.PWM.SetChannel( 5, 0 );
  else
  ReefAngel.PWM.SetChannel( 5, PWMSlope(21,0,13,0,0,MoonPhase() ,60,0) );

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 5:45 am
by lnevo
Here's the function definition which you can find in Globals.cpp or at http://www.easte.net/RA/html

Code: Select all

byte PWMSlope	(	byte 	startHour,
byte 	startMinute,
byte 	endHour,
byte 	endMinute,
byte 	startPWM,
byte 	endPWM,
byte 	Duration,
byte 	oldValue 
)		
And old value is the % you want the channel at when it's not doing the scheduled slope.

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 5:48 am
by cosmith71
Thanks. I knew about that, but "oldValue" wasn't very descriptive. :D

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 6:53 am
by Tranquil201
Thanks all for the reply on that first question. One time other thing that I need cleared up... My actinics will come on at 1:30PMEST. I've read on other threads something regarding changing light % or the slope duration during the (ON lights period) that the changes will not take effect for 24 hours is that correct? If this is true when can I make adjustments that will take effect right away? Like for instance my lights aren't on right now it's 9:46AM maybe I want to adjust my light schedule through portal to end my actinics at 11:30PM would that take effect tonight or after a full 24 hours? I've read after people have made changes to their lights schedules they would stay on at night and not turn off. I'm asking this because I just recently swapped out my old RA yesterday and installed the RA+ and this happened to me last night where the actinics just got stuck a 15% and didn't turn off. The only difference is with the RA+ I changed to using slope instead of parabola.

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 6:57 am
by cosmith71
You'd have to use in-memory settings instead of the in-program setting you're using now for the Portal settings to work.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 7:02 am
by Tranquil201
I am using internal memory.

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 7:04 am
by cosmith71
I think this:

Code: Select all

ReefAngel.PWM.SetDaylight( PWMSlope(14,0,22,30,15,60,60,0) );
ReefAngel.PWM.SetActinic( PWMSlope(13,30,23,0,15,80,60,0) );
will override memory settings.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 7:08 am
by lnevo
Yeah your not using memory based on those lines.

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 7:11 am
by Tranquil201
OK so to answer my question.. So this should all take effect today and my lights will turn off at 11:00PM tonight?


cosmith71 wrote:I think this:

Code: Select all

ReefAngel.PWM.SetDaylight( PWMSlope(14,0,22,30,15,60,60,0) );
ReefAngel.PWM.SetActinic( PWMSlope(13,30,23,0,15,80,60,0) );
will override memory settings.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 7:13 am
by cosmith71
I should think so.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 7:16 am
by Tranquil201
Ok hopefully this does it. If they don't turn off ill just manually override them to off and see if they take effect in 24 hours.
cosmith71 wrote:I should think so.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 8:11 am
by cosmith71
I've never heard of that before.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 8:50 am
by Tranquil201
Ok I uploaded

ReefAngel.PWM.SetDaylight( PWMSlope(14,0,22,30,15,60,60,0) );
ReefAngel.PWM.SetActinic( PWMSlope(13,30,23,0,15,80,60,0) );

Should the percentage values reflect under internal memory within portal? In portal it's showing

Daylights Start 15% End 60% (14,0,22,30,15,60,60,0) );
Actinics Start 15% End 75% (13,30,23,0,15,80,60,0) ); end should be 80%

Do I need to manually change the percent in portal or will it change once it goes through the loop?

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 8:57 am
by cosmith71
They are separate. The portal values are irrelevant when you've specified times, etc in the code. They won't update, nor will it make any difference what you change them to since you've hard coded the values.

--Colin

Re: PWM Slope Code

Posted: Sun Jul 27, 2014 9:00 am
by Tranquil201
Ah ok thanks

cosmith71 wrote:They are separate. The portal values are irrelevant when you've specified times, etc in the code. They won't update, nor will it make any difference what you change them to since you've hard coded the values.

--Colin