Datasheet

Chapter 2: EEPROM Tricks and Program Tips ยท Page 63
Figure 2-6
Debug Terminal
Displaying the State
of pbSense
Zeros repeat every
1/10 second while the
button is not pressed.
Ones repeat while
the button is pressed.
Example Program: TestPushbutton.bs2
โˆš Enter, save, and run TestPushButton.bs2.
โˆš The Debug Terminal should display a message, and then start displaying a series
of repeating zeros every 1/10 second.
โˆš Watch the Debug Terminal as you press, hold, and release the pushbutton.
While you were holding the pushbutton down, the Debug Terminal should have
displayed a series of ones instead of zeros.
Troubleshooting if the Debug Terminal doesn't display 1s while you have the button
pressed, check your circuit. Also check your circuit if the program displays 1s while the
pushbutton is not pressed.
If the program starts over again instead of continuing to display binary values, make sure to
press/hold/release the button on the breadboard, not the Reset button on the SumoBot
PCB.
' -----[ Title ]--------------------------------------------------------------
' Applied Robotics with the SumoBot - TestPushButton.bs2
' Displays the state of the pushbutton sensed by P6 in the Debug Terminal.
' {$STAMP BS2} ' Target = BASIC Stamp 2
' {$PBASIC 2.5} ' Language = PBASIC 2.5
' -----[ I/O Definitions ]---------------------------------------------------