28125 Parallax Inc, 28125 Datasheet - Page 218

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
Boe-Bot should move forward. If you cast a shadow over one of the photoresistors, the
Boe-Bot should turn in the direction of the photoresistor that senses the shadow.
' Robotics with the Boe-Bot - ShadowGuidedBoeBot.bs2
' Boe-Bot detects shadows cast by your hand and tries to follow them.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
FREQOUT 4, 2000, 3000
DO
LOOP
How ShadowGuidedBoeBot.bs2 Works
The
conditions: both, left, right, neither. Depending on which condition is detected,
commands deliver pulses for one of the following maneuvers: forward, pivot right, pivot
left, or sit still. Regardless of the condition, one of the four sets of pulses will be
delivered each time through the
remember to include the
pulses.
IF (IN6
ELSEIF (IN6
ELSEIF (IN3
ELSE
ENDIF
PAUSE 20
PULSOUT 13, 850
PULSOUT 12, 650
PULSOUT 13, 750
PULSOUT 12, 650
PULSOUT 13, 850
PULSOUT 12, 750
PULSOUT 13, 750
PULSOUT 12, 750
IF…THEN
Enter, save, and run ShadowGuidedBoeBot.bs2.
Use your hand to cast shadows over the photoresistor dividers.
Study this program carefully and make sure you understand how it works. It is
very short, yet very powerful.
= 0) AND (IN3 = 0) THEN
statement in the
= 0) THEN
= 0) THEN
PAUSE 20
DO…LOOP
DO…LOOP
to ensure the low time between each pair of servo
. After the
looks for one of the four possible shadow
' Stamp directive.
' PBASIC directive.
' Start/restart signal.
' Both detect shadows, forward.
' Left detects shadow,
' pivot left.
' Right detects shadow,
' pivot right.
' No shadow, sit still
' Pause between pulses.
IF…THEN
statement, it’s important to
PULSOUT

Related parts for 28125