Datasheet

Page 122· Applied Robotics with the SumoBot
Your Turn - Testing All Four
Your SumoBot will eventually need to check and process information from all four IR
object detectors each time through the Main Routine’s
DO...LOOP. In this case, it's a
matter of incorporating elements from the IR object detector programs from this activity
and Activity #1 into a single program. If you start with one of the programs, you can
copy the following elements from the other program:
PIN directives, variable
declarations,
FREQOUT commands and statements that set variables equal to pin names.
After that, all that remains is modifying a couple of
DEBUG commands.
Save a copy of TestSideIrObjectDetectors.bs2 as TestAllIrObjectDetectors.bs2.
Copy all the elements you need from TestFrontIrObjectDetectors.bs2 into your
new program.
Modify the
DEBUG commands to display all the object detection bits.
Test and troubleshoot until you've got it working.
Save the modified program.
ACTIVITY #6: TESTING ALL SENSORS
This activity combines portions of test code that have already been developed for the
following sensors into one program:
Front IR object detectors
Side IR object detectors
Front QTI line sensors
Pushbutton
Combining Programs
So far, the SumoBot has seven sensors: 2 QTI line sensors, 4 IR object detectors, and 1
pushbutton. Each has a test program that displays binary values for these sensors, either
one at a time or in pairs. This next example combines them into a master program that
stores the state of each sensor via a series of subroutines, then displays them all with a
single
DEBUG command. This can actually be done with minimal additions, effort, and
debugging.