28125 Parallax Inc, 28125 Datasheet - Page 280

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
detectors read "no object" for brief moments, but this is not reason enough to
give up the chase.
' Robotics with the Boe-Bot - SumoBoeBot.bs2
' Search for object, lock onto it and push it.
' {$STAMP BS2}
' {$PBASIC 2.5}
irDetectLeft
irDetectRight
pulseLeft
pulseRight
' -----[ Initialization ]----------------------------------------------
DEBUG "Program Running!"
FREQOUT 4, 2000, 3000
' -----[ Main Routine ]------------------------------------------------
Main:
' Spin around slowly until an object is spotted
' Now figure out exactly where the object is and go toward it
DO
LOOP UNTIL (irDetectLeft = 0) OR (irDetectRight = 0)
DO
' Object in both detectors -- go forward
' Object on left - go left
' Object on right - go right
' No object -- go forward anyway, because the detectors will
PULSOUT 13, 790
PULSOUT 12, 790
PAUSE 15
GOSUB Check_IRs
IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
ELSEIF (irDetectLeft = 0) THEN
ELSEIF (irDetectRight = 0) THEN
ELSE
pulseLeft =
pulseRight = 650
pulseLeft =
pulseRight = 650
pulseLeft =
pulseRight = 850
pulseLeft =
pulseRight = 650
VAR
VAR
VAR
VAR
850
650
850
850
Bit
Bit
Word
Word
' Left IR reading
' Right IR reading
' pulse values for servos
' Signal start/reset.
' Rotate slowly
' 5 ms for detectors
' While looking for object
' Forward
' Left toward object
' Right toward object
' momentarily show
' "no object" as the
' Boe-Bot is adjusting

Related parts for 28125