I've never used the Button command before but here's something simple to try.
You'll probably need to modify your readbutton routines so it returns to the Main loop after testing for button activity.
Code:
x VAR BYTE
main:
High LED5 ' Turn on LED connected to PORTB.0
FOR x = 0 TO 250 ' Loop here for 1 second while monitoring
PAUSE 4
GOSUB readbutton1
GOSUB readbutton2
NEXT x
Low LED5 ' Turn off LED connected to PORTB.0
FOR x = 0 TO 250 ' Loop here for 1 second while monitoring
PAUSE 4
GOSUB readbutton1
GOSUB readbutton2
NEXT x
GOTO main
readbutton1:
Button bt1,0,40,0,B1,0,readbutton2 ' main instead of redabutton2?
Toggle LED1 ' Toggle LED if pressed
RETURN
readbutton2:
Button button2,0,40,0,B2,0,readbutton1 ' main instead of redabutton1?
Toggle LED2 ' Toggle LED if pressed
RETURN
END
Bookmarks