Datasheet
Page 114ยท Applied Robotics with the SumoBot
Read_Line_Sensors:
HIGH qtiPwrLeft ' Turn on QTIs
HIGH qtiPwrRight
HIGH qtiSigLeft ' Push signal voltages to 5 V
HIGH qtiSigRight
PAUSE 1 ' Wait 1 ms for capacitors
INPUT qtiSigLeft ' Start the decays
INPUT qtiSigRight
PULSOUT DummyPin, qtiThreshold ' Wait for threshold time
qtiStateLeft = qtiSigLeft ' Snapshot of QTI signal states
qtiStateRight = qtiSigRight
LOW qtiPwrLeft ' Turn off QTIS
LOW qtiPwrRight
RETURN
The last step is to go through the Main Routine and change references to variables from
qtiLeft and qtiRight to qtiStateLeft and qtiStateRight. The values also have to
be compared to 0 or 1 instead of
threshold. For example:
IF qtiLeft < qtiThreshold THEN
has to be changed to
IF qtiStateLeft = 0 THEN
Example Program: QtiPulseDecayTrick.bs2
โ Start with your SumoBot parked on the black part of your practice sumo ring.
โ Enter, save, and run QtiPulseDecayTrick.bs2.
โ Verify that the Debug Terminal shows that the QTIs report 1 if they are over the
black practice ring surface or 0 if they are over the white tawara line.
' -----[ Title ]--------------------------------------------------------------
' Applied Robotics with the SumoBot - QtiPulseDecayTrick.bs2
' This program uses the Pulse-Decay trick to discern between black and white
' with QTI line sensors.
' Important: You must start with the QTIs seeing black.
' {$STAMP BS2} ' Target = BASIC Stamp 2
' {$PBASIC 2.5} ' Language = PBASIC 2.5