You have two things to keep track of not counting the HPWM portion.
1.) how many times the button is pressed.
2.) how long it is pressed.
Darrel Taylor has a great example of doing #2 in the memory button thread.
http://www.picbasic.co.uk/forum/showthread.php?t=3291
Here's how I see it being done.
check the button
is the button being held down?
yes or no
if yes, turn if off.
if no, is the light on full?
yes or no
if yes, dim it some
if no, is it 1st level dimmed?
yes or no
if yes, dim it some more
if no, is it second level dimmed?
yes or no
if yes, turn it back on full
if no, dim it some more
Bill H
Bookmarks