28125 Parallax Inc, 28125 Datasheet - Page 98

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
Example Program: BothServosThreeSeconds.bs2
Here’s an example of making the servos turn in one direction for three seconds, then
reversing their direction.
' Robotics with the Boe-Bot - BothServosThreeSeconds.bs2
' Run both servos in opposite directions for three seconds, then reverse
' the direction of both servos and run another three seconds.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
counter VAR Byte
FOR counter = 1 TO 122
NEXT
FOR counter = 1 TO 122
NEXT
END
Verify that each servo turned one direction for three seconds, and then reversed direction
and turned for three more seconds. Did you notice that while the servos reversed at the
same moment, they were always turning in opposite directions? Why would this be
useful?
Your Turn – Predict Servo Run Time
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
Enter, save, and run BothServosThreeSeconds.bs2.
Pick a time (six seconds or less), that you want your servos to turn.
Divide the number of seconds by 0.024.
Your answer is the number of loops you will need.
Modify BothServosThreeSeconds.bs2 so that it makes both servos run for the
amount of time you selected.
Compare your predicted run time to the actual run time.

Related parts for 28125