Datasheet

Chapter 4: Navigation Tips · Page 195
closely matches the conditions for your competition ring, taking into account
nearby objects, whether or not the floor reflects infrared, etc.
Also, make sure to adjust your QTI threshold calculation if you encountered
problems with detecting the crease marks in the SumoBot Robot Competition
Ring poster. See Activity #5 in this chapter.
Download your updated SumoWrestler.bs2 into SumoBot A.
Save a copy of the program as MySumoWithSubrtoutines.bs2.
Incorporate the changes you made in MySumoWrestler.bs2 into this new
program's
Search_Pattern subroutine. What differences did you encounter?
Download your updated MySumoWrestler.bs2 into SumoBot B.
Let them compete against each other using the same starting positions as the
previous activity.
' -----[ Title ]--------------------------------------------------------------
' Applied Robotics with the SumoBot - SumoWrestler.bs2
' SumoWrestler.bs2 modified so that each state is contained by a
' subroutine.
' {$STAMP BS2} ' Target = BASIC Stamp 2
' {$PBASIC 2.5} ' Language = PBASIC 2.5
' -----[ I/O Definitions ]---------------------------------------------------
ServoLeft PIN 13 ' Left servo connected to P13
ServoRight PIN 12 ' Right servo connected to P12
qtiPwrLeft PIN 10 ' Left QTI on/off pin P10
qtiSigLeft PIN 9 ' Left QTI signal pin P9
qtiPwrRight PIN 7 ' Right QTI on/off pin P7
qtiSigRight PIN 8 ' Right QTI signal pin P8
DummyPin PIN 6 ' I/O pin for pulse-decay P6
LedSpeaker PIN 5 ' LED & speaker connected to P5
IrLedLS PIN 2 ' Left IR LED connected to P2
IrSenseLS PIN 1 ' Left IR detector to P1
IrLedLF PIN 4 ' Left IR LED connected to P4
IrSenseLF PIN 11 ' Left IR detector to P11
IrLedRF PIN 15 ' Right IR LED connected to P15
IrSenseRF PIN 14 ' Right IR detector to P14
IrLedRS PIN 3 ' Right IR LED connected to P3