Please, some help using BUTTON command?
AGauger
Posts: 1
Please, some help using ‘BUTTON’ command?
·
I have successfully implemented the BUTTON command from the example given in the documentation but I’m not familiar enough with the programming language to implement multiple buttons.
I have been using the following code while having a momentary button connected to pin #7:
·
' {$STAMP BS2}
' {$PBASIC 2.5}
Btn PIN 7
btnWrk VAR Byte
Main:
PAUSE 5
BUTTON Btn, 0, 255, 20, btnWrk, 0, No_Press
DEBUG "Button on pin 7 pressed!"
No_Press:
GOTO Main
·
Can someone send me the code to implement a second button where when the momentary button connected to pin 7 is closed the DEBUG message says, “Button on pin 7 pressed!" and when the momentary button connected to pin 8 is closed the DEBUG message says, “Button on pin 8 pressed!”?
·
Any assistance would be greatly appreciated.
Thanks,
~Aaron
·
I have successfully implemented the BUTTON command from the example given in the documentation but I’m not familiar enough with the programming language to implement multiple buttons.
I have been using the following code while having a momentary button connected to pin #7:
·
' {$STAMP BS2}
' {$PBASIC 2.5}
Btn PIN 7
btnWrk VAR Byte
Main:
PAUSE 5
BUTTON Btn, 0, 255, 20, btnWrk, 0, No_Press
DEBUG "Button on pin 7 pressed!"
No_Press:
GOTO Main
·
Can someone send me the code to implement a second button where when the momentary button connected to pin 7 is closed the DEBUG message says, “Button on pin 7 pressed!" and when the momentary button connected to pin 8 is closed the DEBUG message says, “Button on pin 8 pressed!”?
·
Any assistance would be greatly appreciated.
Thanks,
~Aaron
Comments
DIRS=$0000
main:
DO WHILE IN7=0 AND IN8=0
LOOP
IF IN7=1 THEN
DEBUG "7 pressed" ,CR
ELSEIF IN8=1 THEN
DEBUG "8 pressed" ,CR
ENDIF
PAUSE 500
GOTO main
Jeff T.
http://www.parallax.com/detail.asp?product_id=27220
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support