
Originally Posted by
brianmorris
Steve, When i run your code i get all three leds on, making white, press button i get Bright Blue, press button again i get more of a regular blue, again i get a dim green with both green and red leds lit.
But at least the switch is working.
I guess i've been lucky then, modifs in RED
Code:
TRISIO = 0 ' Clear all I/Os
GPIO = %00001000 ' GP3: Input, other pin: Output
ButtonCount VAR BYTE
CLEAR
MAIN:
IF !SwitchPin THEN ' Switch down?
' - YES
If ButtonCount = 3 THEN ButtonCount = 0 ' - Currently on GP3 (MCLR)? If so, pass go, claim 200$
PWM ButtonCount,127,100 ' - Light Show
LOW ButtonCount
WHILE !SwitchPin : WEND ' - Spin 'till button is released
PAUSE 50 ' - arbitrary debouince delay
ButtonCount = ButtonCount + 1 ' - Point to next LED
endif '
GOTO MAIN
Bookmarks