Datasheet

Page 124· Applied Robotics with the SumoBot
has to be changed back to an input first. So, the Main Routine of TestPushButton.bs2
will not serve our purpose, but this simple subroutine will.
Add a
Read_Pushbutton subroutine:
Read_Pushbutton:
INPUT pbSense ' Set I/O pin to input
pushbutton = pbSense ' Store state of pbSense
RETURN
Some of the initialization routines will not be necessary. Others, like
Calibrate_Qtis
are crucial. It's important to pick and choose what you'll need for both the Initialization
and Main Routine. You'll need to make sure to call all the subroutines and display only
the relevant values.
Construct an Initialization section and Main Routine that will make your
program function.
Test and troubleshoot it.
Convert all active low bit variables to active high.
Compare what you came up with to the TestAllSensors.bs2 below.
Example Program: TestAllSensors.bs2
Run and test TestAllSensors.bs2.
' -----[ Title ]--------------------------------------------------------------
' Applied Robotics with the SumoBot - TestAllSensors.bs2
' This program is a combination of the following:
' - QtiPulseDecayTrick.bs2
' - TestFrontIrObjectDetectors.bs2
' - TestSideIrObjectDetectors.bs2
' - TestPushButton.bs2
' - TestLedSpeaker.bs2
' Important: You must start with the QTIs seeing black.
' {$STAMP BS2} ' Target = BASIC Stamp 2
' {$PBASIC 2.5} ' Language = PBASIC 2.5
' -----[ I/O Definitions ]---------------------------------------------------