PWM Ramp up and Ramp down

Hi, I need help in coding a aquarium LED controller. I would have 24 pwm marker points, 1 for each hour of the day (24 marker points for one channel, one pwn pin).

Between two marker points I want to pwm value to increase / decrease in a linear or in a curve form. For example if at T1 pwm is set to 0 and at T2 the pwm is set to 60, every minute between T1 to T2 the pwm value will increment by 1, so at 60th minute the pwm reaches 60.

Could you please help.

Start with the [u]Fade Example[/u] and adjust the fade-time as desired.

increase / decrease in a linear or in a curve form.

Just be aware that your eyes are not linear and 50% PWM will be perceived as brighter than half-bright.

And if this has to be synchronized to real-time you’ll probably need a real-time clock module (RTC) to keep the hours from drifting.

Smoothing steps across the hour could have different steps when the hour changes.

You could also have increase/decrease brightness points at programmed times.

8-bit PWM (Arduino’s default) has only about 25 equal brightness steps, as DVDdoug already explained.
Leo…