Page 1 of 1

Re: PWM Slope

Posted: Mon Dec 31, 2012 9:26 am
by rimai
There is an overnight function available:
http://forum.reefangel.com/viewtopic.php?p=8905#p8905

Re: PWM Slope

Posted: Mon Dec 31, 2012 10:21 am
by lnevo
Cool. Good to know. On my other question... will an inverse slope work ? Where we dim to dark and dim back up?

Re: PWM Slope

Posted: Mon Dec 31, 2012 10:23 am
by rimai
I think so....
Never tried.

Re: PWM Slope

Posted: Mon Dec 31, 2012 10:33 am
by lnevo
Guess I will give it a try and report back..

PWM Slope

Posted: Tue Jan 01, 2013 3:00 pm
by lnevo
It did not seem to work. The portal shows no change between my darkness hours...no slope seen :(

Re: PWM Slope

Posted: Tue Jan 01, 2013 4:48 pm
by rimai
Did you use the overnight version?

PWM Slope

Posted: Tue Jan 01, 2013 4:54 pm
by lnevo
Didnt need the overnight..i'll paste my code later tonight. The overnight was to support people doing a ramp up separate from ramp down.

Re: PWM Slope

Posted: Tue Jan 01, 2013 6:36 pm
by lnevo
Here's the block of code I tested last night. From the portal data, it seems to have dropped to 0 from 2am-5am.

Code: Select all

   if ((hour()>=2) && (hour()<5)) { // 2:00am-4:59am
      // Some complete darkness. Ramp down to 0 and back up to MoonPhase().
      ReefAngel.PWM.SetDaylight(PWMSlope(2,0,5,0,MoonPhase(),0,30,0));
      ReefAngel.PWM.SetActinic(PWMSlope(2,0,5,0,MoonPhase(),0,30,0));
    } else {
      // Set moonlights to the MoonPhase
      ReefAngel.PWM.SetDaylight(MoonPhase());
      ReefAngel.PWM.SetActinic(MoonPhase());
    }

Re: PWM Slope

Posted: Tue Jan 01, 2013 9:22 pm
by rimai
Oh no...
You need to do the opposite...
You need to overnight function and ramp up at 5am and down at 2am

PWM Slope

Posted: Tue Jan 01, 2013 9:26 pm
by lnevo
Ahhh got it. Will try tomorrow.

PWM Slope

Posted: Wed Jan 02, 2013 4:21 pm
by lnevo
I noticed the overnight function is not in the libraries?

Also, i noticed a function ReversePWM that was used in the cloud program...would that be more direct to use for what I am trying to do?

Re: PWM Slope

Posted: Wed Jan 02, 2013 4:29 pm
by rimai
Correct, the overnight never made to the libraries.
The reverse version is on seconds and not minutes, but it will also not cross over to next day.

PWM Slope

Posted: Fri Jan 04, 2013 5:46 am
by lnevo
Worked perfectly last night! Thanks Roberto!

Re: PWM Slope

Posted: Fri Jan 04, 2013 8:58 am
by rimai
Awesome!!! :)