27404 Parallax Inc, 27404 Datasheet - Page 117

COMPETITION RING FOR SUMOBOT

27404

Manufacturer Part Number
27404
Description
COMPETITION RING FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 27404

Accessory Type
Hobby and Education
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Incorporating the Pulse-Decay Trick into Another Program
Here is how to incorporate the test code from QtiPulseTrickLeft.bs2 into
TestFrontQtiLineSensors.bs2 from Activity #2. The first step is to declare a dummy
name for P6.
Also declare a couple of extra bit variables to store the states of
qtiSigRight
command that passes the threshold amount of time:
Next, move the entire contents of the QTI calibration code block from the initialization
routine into a single subroutine and name it
After the
of the
essentially the same as the code block from the previous Your Turn.
Read_Line_Sensors
DummyPin
qtiStateLeft
qtiStateRight
Calibrate_Qtis:
Calibrate_Qtis
HIGH qtiPwrLeft
HIGH qtiSigLeft
PAUSE 1
RCTIME qtiSigLeft, 1, qtiLeft
LOW qtiPwrLeft
HIGH qtiPwrRight
HIGH qtiSigRight
PAUSE 1
RCTIME qtiSigRight, 1, qtiRight
qtiThreshold = (qtiLeft + qtiRight) / 2
qtiThreshold = qtiThreshold / 4
IF threshold > 220 THEN
ELSE
ENDIF
RETURN
threshold = threshold - 220
threshold = 0
(P8). Remember, they need a snapshot immediately after the
PIN
VAR
VAR
subroutine is called, the program can use a modified version
subroutine that uses the pulse-decay trick. Here it is, and it's
6
Bit
Bit
Calibrate_Qtis
' Turn left QTI on
' Discharge capacitor
' Measure charge time
' Turn left QTI off
' Turn right QTI on
' Discharge capacitor
' Measure charge time
' Calculate average
' Take 1/4 average
' For code overhead
:
qtiSigLeft
PULSOUT
(P9) and
PIN

Related parts for 27404