Steve,
there is a number of things wrong now.
in your main loop there will be no PWM output until you press the button.
Once you have pressed the button it will execute the "decrease brighness" loop since flag=0
(flag is always 0 in your case!!!)
Since you don't check for "key still pressed?" in the While...Wend Loop
it counts bright from 254 (preset value) down to zero.
with the next decrement (down from zero) bright will be 255.
From there on none of the conditions to output PWM
is true or will ever become true. so nothing happens
regards
Ralph
_______________________________________________
There are only 10 types of people:
Those who understand binary, and those who don't ...
_______________________________________________
Bookmarks