28824 Parallax Inc, 28824 Datasheet - Page 8

SERVOPAL SERVO PULSER TIMER

28824

Manufacturer Part Number
28824
Description
SERVOPAL SERVO PULSER TIMER
Manufacturer
Parallax Inc
Datasheet

Specifications of 28824

Accessory Type
Servo Motor Control
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
BASIC Stamp®
For Use With
28803 - KIT BOARD OF EDU W/O PWR SUPP
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
BOTH
BKWD
FWD
' -----[ Variables ]-------------------------------------------------------
Obstacle
Move
Time
' -----[ Initialization ]--------------------------------------------------
INPUT nInp
DO : LOOP UNTIL nInp
LOW nInp
PAUSE 100
HIGH nInp
PAUSE 100
' -----[ Program Code ]----------------------------------------------------
DO
LOOP
' -----[ Subroutines ]-----------------------------------------------------
'------[ ReadIR ]----------------------------------------------------------
' Read both IR sensors. Put inverted values into position in Obstacle.
ReadIR:
© Parallax, Inc. • ServoPAL (2007.10.30)
Move = FWD
GOSUB DoMotor
DO
LOOP UNTIL Obstacle
IF (Obstacle = LEFT) THEN
ELSEIF (Obstacle = RIGHT) THEN
ELSEIF (Obstacle = BOTH) THEN
ENDIF
DO
LOOP UNTIL Obstacle = NONE AND Alarm '
FREQOUT IREmtR, 1, 38500
Obstacle.BIT0 = ~IRDetR
FREQOUT IREmtL, 1, 38500
GOSUB ReadIR
Move = RIGHT
GOSUB DoMotor
Move = LEFT
GOSUB DoMotor
Move = BKWD
Time = 10
GOSUB DoMotor
DO UNTIL Alarm : LOOP
Move = RIGHT
Time = 5
GOSUB DoMotor
GOSUB ReadIR
CON
CON
CON
VAR
VAR
VAR
3
0
3
Nib
Nib
Word
'Start BOE-Bot moving forward,
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'
'Reading from IR detectors.
'Motor command.
'Make sure nInp isn't being driven.
'Wait for ServoPAL to power up.
'Set pin to an output and hold it low
'
'Raise the pin.
'Activate the right IR emitter.
'Read the right IR sensor (and invert).
'Activate the left IR emitter.
using the DoMotor routine.
Read obstacle detectors,
for 100mS to reset ServoPAL.
until an obstacle is found.
Obstacle on the left?
On the right?
In front?
Yes: Start rotating right.
Yes: Start rotating left.
Yes: Start backing up,
Evasive action is being taken.
Read the obstacle detectors.
Continue (timed) evasive maneuver,
Wait for alarm to time out.
Then start rotating right,
until clear AND time is up.
and set alarm for 1 sec.
setting alarm for 1/2 sec.
Page 8 of 9

Related parts for 28824