27404 Parallax Inc, 27404 Datasheet - Page 105

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
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ I/O Definitions ]---------------------------------------------------
qtiPwrLeft
qtiSigLeft
qtiPwrRight
qtiSigRight
' -----[ Variables ]----------------------------------------------------------
qtiLeft
qtiRight
' -----[ Initialization ]-----------------------------------------------------
DEBUG CLS, "FRONT QTI Sensors", CR,
' -----[ Main Routine ]-------------------------------------------------------
DO
LOOP
' -----[ Subroutines ]--------------------------------------------------------
Read_Line_Sensors:
GOSUB Read_Line_Sensors
DEBUG CRSRX, 0, DEC5 qtiLeft
DEBUG CRSRX, 8, DEC5 qtiRight
PAUSE 100
HIGH qtiPwrLeft
HIGH qtiSigLeft
PAUSE 1
RCTIME qtiSigLeft, 1, qtiLeft
LOW qtiPwrLeft
HIGH qtiPwrRight
HIGH qtiSigRight
PAUSE 1
RCTIME qtiSigRight, 1, qtiRight
RETURN
"Left
"-----
PIN
PIN
PIN
PIN
VAR
VAR
Right", CR,
-----", CR
10
9
7
8
Word
Word
' Target = BASIC Stamp 2
' Language = PBASIC 2.5
' Left QTI on/off pin
' Left QTI signal pin
' Right QTI on/off pin
' Right QTI signal pin
' Stores left QTI time
' Stores right QTI time
' Display heading
' DO...LOOP repeats indefinitely
' Update qtiLeft & qtiRight
' Display time measurement
' Display time measurement
' Delay for slower PCs
' Turn left QTI on
' Discharge capacitor
' Measure charge time
' Turn left QTI off
' Turn right QTI on
' Discharge capacitor
' Measure charge time

Related parts for 27404