28125 Parallax Inc, 28125 Datasheet - Page 273

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
FREQOUT 4, 2000, 3000
DO
LOOP
How AvoidTableEdge.bs2 Works
A
time through the main (
functions as an index for a
argument.
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
ELSEIF (irDetectRight = 1) THEN
ELSEIF (irDetectLeft = 1) THEN
ELSE
ENDIF
FOR loopCount = 1 TO pulseCount
NEXT
FOR…NEXT
pulseCount = 1
pulseLeft = 850
pulseRight =
pulseCount = 10
pulseLeft = 650
pulseRight =
pulseCount = 10
pulseLeft = 850
pulseRight =
pulseCount = 15
pulseLeft = 650
pulseRight =
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
PAUSE 20
loopCount
Since this program is a modified version of FastIrRoaming.bs2, only changes to the program
are discussed here.
loop is added to the program to control how many pulses are delivered each
650
650
850
850
DO…LOOP
VAR
FOR…NEXT
) routine.
Byte
loop and
Two variables are added,
pulseCount
' Signal program start/reset.
' Main Routine.
' Check IR detectors.
' Decide navigation.
' Both detected,
' one pulse forward.
' Right not detected,
' 10 pulses left.
' Left not detected,
' 10 pulses right.
' Neither detected,
' back up and try again.
' Send pulseCount pulses
is used as the
loopCount
EndValue

Related parts for 28125