
Originally Posted by
Dave
But that's only using 1 button Art not 2 as in the title of the thread.....
Whoops!
No need to accommodate contact bounce for the buttons then.
Code:
flipflop var bit ‘ 1 = LED is on 0 = LED is off
flipflop = 0 ‘ start with LED off at power up, or on if you want to
trisb.0 = 1’ buttonA pin input ON
trisb.1 = 1’ buttonB pin input OFF
trisb.7 = 0’ LED pin output
cycle: 'program cycle
if portb.0 = 1 then
flipflop = 1 ‘ set memory bit
endif
if portb.1 = 1 then
flipflop = 0 ‘ reset memory bit
endif
portb.7 = flipflop ‘ set LED on or off
goto cycle ‘ repeat loop forever
Bookmarks