122-27400 Parallax Inc, 122-27400 Datasheet - Page 60

MANUAL FOR SUMOBOT

122-27400

Manufacturer Part Number
122-27400
Description
MANUAL FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 122-27400

Accessory Type
Manual
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
Page 50 · SumoBot – Mini Sumo Robotics
' -----[ Subroutines ]-----------------------------------------------------
Read_Line_Sensors:
Read_IR_Sensors:
Creep_Forward:
HOW IT WORKS
After the Reset code for Run/Don't Run developed in the chapter 4, the SumoBot reads
the QTI sensors and calculates a suitable threshold level for the playing field that will be
used during the match. The net effect is to calculate the average sensor reading ((left +
right) / 2) and then divide this value by four. The blackThresh variable holds this level
and is recalculated for each match (this works because the SumoBot starts in near the
center of the ring, over the black surface). Using this strategy, the SumoBot can deal
with variable ambient lighting conditions that may change from match to match.
DIRS = $0000
GOTO Reset
HIGH LLinePwr
HIGH RLinePwr
HIGH LLineIn
HIGH RLineIn
PAUSE 1
RCTIME LLineIn, 1, lLine
RCTIME RLineIn, 1, rLine
LOW LLinePwr
LOW RLinePwr
' convert readings to bits
LOOKDOWN lLine, >=[1000, 0], lbLeft
LOOKDOWN rLine, >=[1000, 0], lbRight
RETURN
FREQOUT LfIrOut, 1, 38500
irLeft = ~LfIrIn
FREQOUT RtIrOut, 1, 38500
irRight = ~RtIrIn
RETURN
FOR pulses = 1 TO 20
NEXT
RETURN
PULSOUT LMotor, LFwdSlow
PULSOUT RMotor, RFwdSlow
PAUSE 20
' disable all outputs
' reset for next round
' activate sensors
' discharge caps
' read left sensor
' read right sensor
' deactivate sensors
' 0 = black, 1 = line
' modulate left IR LED
' read input (1 = target)
' modulate right IR LED
' read input (1 = target)

Related parts for 122-27400