Parallax Boe-Bot Assembly page 53

Mini-sumo robotics assembly documentation and programming
Hide thumbs Also See for Boe-Bot:
Table of Contents

Advertisement

END
' -----[ Subroutines ]-----------------------------------------------------
Read_IR_Sensors:
FREQOUT LfIrOut, 1, 38500
irLeft = ~LfIrIn
FREQOUT RtIrOut, 1, 38500
irRight = ~RtIrIn
RETURN
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.
Chapter 4: Infrared Object Detection · Page 43
' modulate left IR LED
' read input (1 = target)
' modulate right IR LED
' read input (1 = target)

Advertisement

Table of Contents
loading

This manual is also suitable for:

QuadcrawlerToddlerSumobotHexcrawler

Table of Contents