28125 Parallax Inc, 28125 Datasheet - Page 193

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
' -----[ Title ]--------------------------------------------------------------
' Robotics with the Boe-Bot - RoamingWithWhiskers.bs2
' Boe-Bot uses whiskers to detect objects, and navigates around them.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Variables ]----------------------------------------------------------
pulseCount
' -----[ Initialization ]-----------------------------------------------------
FREQOUT 4, 2000, 3000
' -----[ Main Routine ]-------------------------------------------------------
DO
LOOP
' -----[ Subroutines ]--------------------------------------------------------
Forward_Pulse:
Turn_Left:
IF (IN5
ELSEIF (IN5
ELSEIF (IN7
ELSE
ENDIF
PULSOUT 13,850
PULSOUT 12,650
PAUSE 20
RETURN
FOR pulseCount = 0 TO 20
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Turn_Left
GOSUB Back_Up
GOSUB Turn_Right
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Forward_Pulse
PULSOUT 13, 650
PULSOUT 12, 650
Try letting the Boe-Bot roam. When it contacts obstacles in its path, it should
back up, turn, and then roam in a new direction.
= 0) AND (IN7 = 0) THEN
VAR
= 0) THEN
= 0) THEN
Byte
' Stamp directive.
' PBASIC directive.
' FOR...NEXT loop counter.
' Signal program start/reset.
' Both whiskers detect obstacle
' Back up & U-turn (left twice)
' Left whisker contacts
' Back up & turn right
' Right whisker contacts
' Back up & turn left
' Both whiskers 1, no contacts
' Apply a forward pulse
' and check again
' Send a single forward pulse.
' Left turn, about 90-degrees.

Related parts for 28125