Using Float Switch ports for Dimming

Basic / Standard Reef Angel hardware
Post Reply
Kakorb
Posts: 19
Joined: Fri Jul 17, 2015 2:42 pm

Re: Using Float Switch ports for Dimming

Post by Kakorb »

I have some ldd drivers I want to hook to my ato port like above. I was wondering about code to slowly dim them up and down for sunrise and set. I new to all this so I don't know much and need help
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Using Float Switch ports for Dimming

Post by cosmith71 »

Start out with this in setup. Use one port or both to fit your needs (i.ie, whites on the lowATO and blues on the highATO).

Code: Select all

pinMode(lowATOPin,OUTPUT);
pinMode(highATOPin,OUTPUT);
Then something like this goes in the loop to control the lights. Again, use one port or both.

Code: Select all

analogWrite(lowATOPin, (PWMSlope(9,0,20,30,0,100,60,0)*2.55));
analogWrite(highATOPin, (PWMSlope(9,0,20,30,0,100,60,0)*2.55));
Here's what the numbers mean.

Turn on at 9:00 AM (9,0) and off at 8:30 PM (20,30). Start at 0% and end at 100% (0,100). Ramp up and down over 60 minutes (60). The final zero is a fallback value, don't worry about changing it. We multiply by 2.55 because PWMSlope returns a value from 0-100 and we need a value from 0-255 for the ATO pins.

So here, the lights will start at 0% and ramp up to 100% from 09:00 to 10:00, then start ramping down again at 7:30 PM (1930) and turn off (0%) at 8:30 PM (2030).

--Colin
Kakorb
Posts: 19
Joined: Fri Jul 17, 2015 2:42 pm

Re: Using Float Switch ports for Dimming

Post by Kakorb »

Do it matter where u put it in the setup and loop. And this all I would need to make it work.
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Using Float Switch ports for Dimming

Post by cosmith71 »

Doesn't really matter, except make sure the loop part is before this:

Code: Select all

// This should always be the last line
    ReefAngel.ShowInterface();
This should be it on the software side.

--Colin
Post Reply