Parallax BASIC Stamp 2e Programming Manual page 89

Table of Contents

Advertisement

2
2
e
NOTE: This is written for the BS2
but can be used for the BS2e,
BS2sx and BS2p also. Locate the
proper source code file or modify
the STAMP directive before
downloading to the BS2e, BS2sx or
BS2p.
5: BASIC Stamp Command Reference - BUTTON
1
Demo Program (BUTTON.bas)
Connect the active-low circuit shown in Figure 5.1 to pin P0 of the BS1. When you press the
button, the Debug screen will display an asterisk (*). Feel free to modify the program to see
the effects of your changes on the way BUTTON responds.
'{$STAMP BS1}
SYMBOL
BtnWrk =
Loop:
' Try changing the Delay value (255) in BUTTON to see the effect of
' its modes: 0=no debounce; 1-254=varying delays before auto-repeat;
' 255=no auto-repeat (one action per button press).
BUTTON 0,0,255,250,BtnWk,0,NoPress
DEBYG "* "
NoPress:
GOTO Loop
2
2
Demo Program (BUTTON.bs2)
sx
p
Connect the active-low circuit shown in Figure 5.1 to pin P0 of the BS2. When you press the
button, the Debug screen will display an asterisk (*). Feel free to modify the program to see
the effects of your changes on the way BUTTON responds.
'{$STAMP BS2}
BtnWrk
VAR
Loop:
' Try changing the Delay value (255) in BUTTON to see the effect of
' its modes: 0=no debounce; 1-254=varying delays before auto-repeat;
' 255=no auto-repeat (one action per button press).
BUTTON 0,0,255,250,BtnWk,0,NoPress
debug "* "
NoPress:
GOTO Loop
B0
BYTE
BASIC Stamp Programming Manual 2.0c • www.parallaxinc.com • Page 87
'STAMP directive (specifies a BS1)
' Workspace for BUTTON instruction.
' Go to NoPress unless P0 = 0.
' Repeat endlessly.
'STAMP directive (specifies a BS2)
' Workspace for BUTTON instruction.
' Go to NoPress unless P0 = 0.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the BASIC Stamp 2e and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents