28125 Parallax Inc, 28125 Datasheet - Page 159

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
' Robotics with the Boe-Bot - MovementWithVariablesAndOneSubroutine.bs2
' Make a navigation routine that accepts parameters.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter
pulseLeft
pulseRight
pulseCount
FREQOUT 4, 2000, 3000
' Forward
pulseLeft = 850: pulseRight = 650: pulseCount = 64: GOSUB Navigate
' Left turn
pulseLeft = 650: pulseRight = 650: pulseCount = 24: GOSUB Navigate
' Right turn
pulseLeft = 850: pulseRight = 850: pulseCount = 24: GOSUB Navigate
' Backward
pulseLeft = 650: pulseRight = 850: pulseCount = 64: GOSUB Navigate
END
Navigate:
Did your Boe-Bot perform the familiar forward-left-right-backward sequence? This
program may be difficult to read at first, because the instructions are arranged in a new
way. Instead of having each variable statement and each
line, they are grouped together on the same line and separated by colons. Here, the
FOR counter = 1 TO pulseCount
NEXT
PAUSE 200
RETURN
PULSOUT 13, pulseLeft
PULSOUT 12, pulseRight
PAUSE 20
Enter, save, and run MovementWithVariablesAndOneSubroutine.bs2.
VAR
VAR
VAR
VAR
Word
Word
Word
Byte
' Signal program start/reset.
GOSUB
command on a different

Related parts for 28125