27404 Parallax Inc, 27404 Datasheet - Page 152

COMPETITION RING FOR SUMOBOT

27404

Manufacturer Part Number
27404
Description
COMPETITION RING FOR SUMOBOT
Manufacturer
Parallax Inc
Datasheet

Specifications of 27404

Accessory Type
Hobby and Education
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Contains lead / RoHS non-compliant
For Use With/related Products
SumoBot®
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Contains lead / RoHS non-compliant
Your Turn - Using PIN Definitions and Constants
Instead of the number 13 in the
can use the
place of the number 12. Since we know that 650 is the
speed-clockwise, a good constant name for this number would be
same lines, 850 can be
for no rotation.
Here is an example of the first one updated with
LOOKUP Command Review
The
braces) and copies that value to
Index
LOOKUP
variable.
Add these
' -----[ I/O Definitions ]--------------------------------------------
ServoLeft
ServoRight
' -----[ Constants ]---------------------------------------------------
' Servo pulse width rotation constants
FS_CCW
FS_CW
NO_ROT
' SumoBot goes forward 3 seconds.
FOR counter = 1 TO 122
NEXT
Modify all the motion routines to use these constants.
LOOKUP Index, [Value1, Value2, ... ValueN], Variable
PULSOUT ServoLeft, FS_CCW
PULSOUT ServoRight, FS_CW
PAUSE 20
PIN
command picks a value from the lookup table (the list within the square
directive
PIN
directives and constant declarations to the program:
FS_CCW
PIN
PIN
CON
CON
CON
ServoLeft
PULSOUT
for full speed counterclockwise, and 750 can be
Variable
13
12
850
650
750
. Likewise, the program can use
command's
. The value
PIN
' Left servo connected to P13
' Right servo connected to P12
' Full speed counterclockwise
' Full speed clockwise
' No rotation
directives and constant names.
Pin
argument, the example program
LOOKUP
PULSOUT Duration
picks depends on the
FS_CW
ServoRight
. Along the
for full-
NO_ROT
in

Related parts for 27404