Here is how I handled a fade in on my LED clock I did recently. You would just need to reverse it to fade out again and add a pause at the end to leave it on for 1 second. Pulse is just a variable that turns various bits of portb on or off.
You can see I'm simply extending the time the LED stays on and reducing the time the LED goes off until it just stays on. You could change the starting values of x and y at the beggining and also change the increment/decrement values from 2 to something else.Code:x = 0 y = 20 for i = 1 to 10 portb = pulse pause x ' turn on LED portb = 0 pause y ' turn off LED y = y - 2 x = x + 2 next portb = pulse ' turn LED on for final time
Here's a link to the clock on youtube so you can see how much fade there is -
Regards
Tony




Bookmarks