The timing of the program is done by counting 10mS periods.
So the entire loop can't take more than 10mS.
When the LED is supposed to be ON, just add a certain amount to the dutycycle each time through the loop until it reaches the set maximum.
The amount you add will determine the speed of the fade.
Subtract some when it is supposed to be OFF, until it reaches 0 or underflows.
Don't add any pauses.
Bookmarks