multiple pwm in the same time

Hello :slight_smile:

I have an arduino mega 2560, and I want to run multiple pwm in the same time.
For example, I want to fade up at 8 o’clock from 0 to 100% in 2 hours.
But at 8:30 I want to fade up on another channel, from 0 to 100%, in 3 hours.
How can I run this different pwm in the same time?

Thanks!

The Arduino Uno has 6 PWM outputs, a MEGA has 15.

Use blink without delat style programming to monitor the time passing and increment the analogWrite value as needed. Not difficult. For example, when 8:00 rolls around (with time read from an RTC, or from your own time sketch), start your increments. 0 to 255 in 120 minutes means an increase in PWM about every 30 seconds. When 8:30 rolls around, then 0 to 255 in 180 minutes means an increase in PWM about every 40-45 seconds. RTCs will increment every second, so just keep reading the time, when the next period arrives increment the PWM and do the math for the next time reading to watch for.