27404 Parallax Inc, 27404 Datasheet - Page 109

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
qtiThreshold
' -----[ Initialization ]-----------------------------------------------------
GOSUB Read_Line_Sensors
qtiThreshold = (qtiLeft + qtiRight) / 2
qtiThreshold = qtiThreshold / 4
DEBUG CLS, "Threshold = ",DEC qtiThreshold
DEBUG CR, CR, "FRONT QTI Sensors", CR,
' -----[ Main Routine ]-------------------------------------------------------
DO
GOSUB Read_Line_Sensors
DEBUG CRSRXY, 0, 5,
IF qtiLeft < qtiThreshold THEN
ELSE
ENDIF
DEBUG CRSRX, 8
IF qtiRight < qtiThreshold THEN
ELSE
DEBUG "White"
DEBUG "Black"
DEBUG "White"
DEC5 qtiLeft, CRSRX, 8,
DEC5 qtiRight, CR
"Left
"-----
PIN
PIN
PIN
PIN
VAR
VAR
VAR
10
9
7
8
Word
Word
Word
Right", CR,
-----", CR
' 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
' Stores black/white threshold
' Get reflection values
' Calculate average
' Take 1/4 average
' Display threshold
' Display column headings
' DO...LOOP repeats indefinitely
' Get reflection values
' Display reflection values
' Indicate what left QTI sees
' Indicate what right QTI sees

Related parts for 27404