27404 Parallax Inc, 27404 Datasheet - Page 115

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
Example Program: QtiPulseTrickLeft.bs2
The QtiPulseTrickLeft.bs2 program verifies that this technique works.
carefully. Especially make sure you can match the commands that deal with P5 and P9 to
the timing diagram in Figure 3-15.
' Applied Robotics with the SumoBot - QtiPulseTrickLeft.bs2
' {$STAMP BS2}
' {$PBASIC 2.5}
qtiStateLeft
time
threshold
' Calibrate QTIs
HIGH 10
HIGH 9
PAUSE 1
RCTIME 9, 1, time
threshold = time / 4
IF threshold > 220 THEN
ELSE
ENDIF
' Main Routine
DO
LOOP
threshold = threshold - 220
threshold = 0
HIGH 9
PAUSE 1
INPUT 9
PULSOUT 6, threshold
qtiStateLeft = IN9
DEBUG HOME, ? qtiStateLeft
PAUSE 100
Make sure the left QTI is over the black surface in your sumo ring.
Enter, save, and run QtiPulseTrickLeft.bs2.
Verify that the Debug Terminal shows that the
when the left QTI sees black and 0 when it sees white.
VAR
VAR
VAR
Bit
Word
Word
' Target device = BS2
' Language = PBASIC 2.5
' Store left QTI state
' Store QTI decay time
' Store b/w threshold
' Turn on left QTI
' Discharge QTI capacitor
' Wait for discharge
' Vo decay time as cap charges
' Use to set threshold
' Account for code overhead
' Discharge QTI capacitor
' Wait for discharge
' Start RC decay
' Wait until threshold time
' Save state of P9
' Display state of P9
' Delay for slower PCs
qtiStateLeft
variable is 1
Examine it

Related parts for 27404