27404 Parallax Inc, 27404 Datasheet - Page 130

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
' -----[ Main Routine ]-------------------------------------------------------
DO
LOOP
' -----[ Subroutine - Calibrate_Qtis ]----------------------------------------
Calibrate_Qtis:
' -----[ Subroutine - Read_Line_Sensors ]-------------------------------------
Read_Line_Sensors:
GOSUB Read_Line_Sensors
GOSUB Read_Object_Detectors
GOSUB Read_Pushbutton
DEBUG HOME,
PAUSE 100
HIGH qtiPwrLeft
HIGH qtiSigLeft
PAUSE 1
RCTIME qtiSigLeft, 1, qtiLeft
LOW qtiPwrLeft
HIGH qtiPwrRight
HIGH qtiSigRight
PAUSE 1
RCTIME qtiSigRight, 1, qtiRight
GOSUB Read_Line_Sensors
qtiThreshold = (qtiLeft + qtiRight) / 2
qtiThreshold = qtiThreshold / 4
IF qtiThreshold > 220 THEN
ELSE
ENDIF
RETURN
qtiThreshold = qtiThreshold - 220
qtiThreshold = 0
? irLS,
? irLF,
? irRF,
? irRS,
? qtiStateLeft,
? qtiStateRight,
? pushbutton
' DO...LOOP repeats indefinitely
' Look for lines
' Look for objects
' Check pushbutton
' Display all sensors states
' 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
' Get reflection values
' Calculate average
' Take 1/4 average
' Account for code overhead

Related parts for 27404