PWM Slope Code

Do you have a question on how to do something.
Ask in here.
Post Reply
Tranquil201
Posts: 19
Joined: Thu Mar 06, 2014 5:02 pm
Location: Hewitt NJ

PWM Slope Code

Post 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) );
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM Slope Code

Post 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
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: PWM Slope Code

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

Re: PWM Slope Code

Post 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.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM Slope Code

Post by cosmith71 »

Thanks. I knew about that, but "oldValue" wasn't very descriptive. :D
Tranquil201
Posts: 19
Joined: Thu Mar 06, 2014 5:02 pm
Location: Hewitt NJ

Re: PWM Slope Code

Post 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.
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM Slope Code

Post 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
Tranquil201
Posts: 19
Joined: Thu Mar 06, 2014 5:02 pm
Location: Hewitt NJ

Re: PWM Slope Code

Post by Tranquil201 »

I am using internal memory.
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM Slope Code

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

Re: PWM Slope Code

Post by lnevo »

Yeah your not using memory based on those lines.
Tranquil201
Posts: 19
Joined: Thu Mar 06, 2014 5:02 pm
Location: Hewitt NJ

Re: PWM Slope Code

Post 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
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM Slope Code

Post by cosmith71 »

I should think so.

--Colin
Tranquil201
Posts: 19
Joined: Thu Mar 06, 2014 5:02 pm
Location: Hewitt NJ

Re: PWM Slope Code

Post 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
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM Slope Code

Post by cosmith71 »

I've never heard of that before.

--Colin
Tranquil201
Posts: 19
Joined: Thu Mar 06, 2014 5:02 pm
Location: Hewitt NJ

Re: PWM Slope Code

Post 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?
Image
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: PWM Slope Code

Post 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
Tranquil201
Posts: 19
Joined: Thu Mar 06, 2014 5:02 pm
Location: Hewitt NJ

Re: PWM Slope Code

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