28125 Parallax Inc, 28125 Datasheet - Page 215

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 - RoamingWithPhotoresistorDividers.bs2
' Boe-Bot detects shadows photoresistors voltage divider circuit and turns
' away from them.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Variables ]----------------------------------------------------------
pulseCount
' -----[ Initialization ]-----------------------------------------------------
FREQOUT 4, 2000, 3000
' -----[ Main Routine ]-------------------------------------------------------
DO
IF (IN6
ELSEIF (IN6
ELSEIF (IN3
GOSUB Back_Up
GOSUB Turn_Left
GOSUB Turn_Left
GOSUB Back_Up
GOSUB Turn_Right
GOSUB Back_Up
GOSUB Turn_Left
Verify that the Boe-Bot avoids shadows by using your hand to cast a shadow
over the photoresistors. Try no shadow, a shadow over the right photoresistor
divider (circuit connected to P3), a shadow over the left photoresistor divider
(circuit connected to P7), and a shadow over both photoresistor dividers.
Update the comments such as the title and descriptions of reactions to whisker
presses to reflect the photoresistor circuit behavior. It should resemble the
program below when you are done.
= 0) AND (IN3 = 0) THEN
Casting shadows over both photoresistors at the same time can be difficult. When the
Boe-Bot is going forward, it is checking the photoresistors around 40 times/second. You will
have to move quickly to cast a shadow over both photoresistors between pulses. It helps to
move your hand rapidly from no shade to full shade to trigger both photoresistors at once.
Alternately, just leave your hand casting shade over both photoresistors while it executes a
maneuver. When it returns from the maneuver and checks the photoresistors again, it
should recognize that both photoresistors are in shade.
= 0) THEN
= 0) THEN
VAR
Byte
' Stamp directive.
' PBASIC directive.
' FOR...NEXT loop counter.
' Start/restart signal.
' Both photoresistors detects
' shadow, back up & U-turn
' (left twice).
' Left photoresistor detects
' shadow, back up & turn right.
' Right photoresistor detects
' shadow, back up & turn left.

Related parts for 28125