Datasheet

Page 128· Applied Robotics with the SumoBot
Your Turn - Cleaning up Names
These variable declaration names have some room for improvement:
irLS VAR Bit ' State of Left Side IR
irLF VAR Bit ' State of Left Front IR
irRF VAR Bit ' State of Right Front IR
irRS VAR Bit ' State of Right Side IR
qtiStateLeft VAR Bit ' Stores snapshot of QtiSigLeft
qtiStateRight VAR Bit ' Stores snapshot of QtiSigRight
The main problem is that they are not really consistent. The object detector variables are
pretty good, there's
irLF for IR-detector-left-front (LF), right-front(RF), and so on. The
qtiState variables don't match the object variable's name conventions, but they should.
If you change it here, you should make sure that every instance in the program is also
changed. This is where the BASIC Stamp Editor's Edit -> Find/Replace feature comes in
handy.
Save TestAllSensors as TestAllSensorsYourTurn.bs2.
In the BASIC Stamp Editor, click Edit and select Find/Replace.
Enter
qtiStateLeft into the Find field and qtiLF into the replace field as
shown in Figure 3-20.
Figure 3-20
Find/Replace
Window
Click Replace all. A message displaying the number of replacements should tell
you how many changes were made as shown in Figure 3-21.
Figure 3-21
Information Window