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

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
' -----[ Subroutines ]-----------------------------------------------------
Read_IR_Sensors:
HOW IT WORKS
This program is functionally similar to the line detection program. The IR sensors are
scanned and, due to variable aliasing, the state of both sensors is held in the Nibble
variable irBits . If no target is detected the SumoBot will go into scanning mode. The
code at Scan will look for the opponent in the last known direction (held in the variable
lastIr ). When a target is detected, the SumoBot will move quickly in the target direction.
The direction is stored in the event the target is lost so that the SumoBot will scan in the
last know target direction.
If you run the program with the power switch in position 1, the Debug Terminal will
display the program's logic based on a target placed in front of the SumoBot. If you run
the program with the power switch in position 2, the SumoBot will rotate in the direction
of the target or scan in the suspect direction.
END
FREQOUT LfIrOut, 1, 38500
irLeft = ~LfIrIn
FREQOUT RtIrOut, 1, 38500
irRight = ~RtIrIn
RETURN
Chapter 4: Infrared Object Detection · Page 43
' modulate left IR LED
' read input (1 = target)
' modulate right IR LED
' read input (1 = target)

Related parts for 122-27400