Keep the resistor - a good value is 10k
CounterA var Byte 'for counter
PushButton var PORTB.2
CounterA=0 ' will be an undefined value on startup
Start:
If PushButton=0 then
CounterA=CounterA+1
Lcdout $fe, 1, "Button Presses =" ' Clear LCD screen
Lcdout $FE, $c0, Countera
While Pushbutton=0:Wend
Pause 2000
endif
goto start ' must tell the program where to go otherwise it will crash
Bookmarks