28125 Parallax Inc, 28125 Datasheet - Page 312

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
' Calculate proportional output and move accordingly.
LOOP
' -----[ Subroutines ]-------------------------------------------------
Navigate_Intersection:
'
' Now back up until one detector sees the black.L & R turn will see
' black on one detector.3- or 4-way will see both black, turn toward
' whichever the bot sees first (random).
' Make 90 degree turn in direction of the detector which sees black
GOSUB Update_LEDs
pulseLeft =
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
GOSUB Send_Pulse
GOSUB Check_For_Intersection
IF (isStuck = 1) THEN
ENDIF
DO
LOOP UNTIL (distanceLeft <=2) AND (distanceRight <=2)
GOSUB Stop_Quickly
DO
LOOP UNTIL (distanceLeft >=4) OR (distanceRight >=4)
GOSUB Stop_Quickly
IF (distanceLeft >=4) THEN
FOR counter = 1 TO Turn90Degree
NEXT
ELSEIF (distanceRight >=4) THEN
Go forward until both sensors read white, through the intersection.
FOR counter = 1 TO Turn90Degree
GOSUB Make_Noise
GOSUB Navigate_Intersection
pulseLeft = 850:
GOSUB Send_Pulse
GOSUB Get_Ir_Distances
GOSUB Update_LEDs
pulseLeft = 650:
GOSUB Send_Pulse
GOSUB Get_Ir_Distances
GOSUB Update_LEDs
PULSOUT 13, 750
PULSOUT 12, 650
PAUSE 20
PULSOUT 13, 850
PULSOUT 12, 750
SetPoint - distanceLeft
pulseRight = 650
pulseRight = 850
' Indicate white/black line
' Are we stuck at intersection?
' Audible indication
' Navigate through it
' Left detector reads black
' Turn 90 degrees left
' without proportional control
* Kpl + CenterPulse
' Forward
' Don't coast forward
' Backward
' Don't coast backward
' so use PAUSE 20
' Right detector reads black
' Turn 90 degrees right

Related parts for 28125