Datasheet
Chapter 2 • Shield, Lights, Servo Motors
66 • Robotics with the BOE Shield-Bot
Pulse Width Controls Speed and Direction
This timing diagram shows how a Parallax continuous rotation servo turns full speed
clockwise when you send it 1.3 ms pulses. Full speed falls in the 50 to 60 RPM range.
What’s RPM? Revolutions Per Minute—the number of full rotations turned in one minute.
What’s a pulse train? Just as a railroad train is a series of cars, a pulse train is a series of pulses
(brief high signals).
Example Sketch: LeftServoClockwise
Create and save the LeftServoClockwise sketch, and run it on your Arduino.
Verify that the servo’s horn is rotating between 50 and 60 RPM clockwise.
/*
Robotics with the BOE Shield – LeftServoClockwise
Generate a servo full speed clockwise signal on digital pin 13.
*/
#include <Servo.h> // Include servo library
Servo servoLeft; // Declare left servo
void setup() // Built in initialization block
{
servoLeft.attach(13); // Attach left signal to pin 13
servoLeft.writeMicroseconds(1300); // 1.3 ms full speed clockwise
}
void loop() // Main loop auto-repeats
{ // Empty, nothing needs repeating
}
Your Turn: Left Servo Counterclockwise
Save LeftServoClockwise as LeftServoCounterclockwise.
In
servoLeft.writeMicroseconds, change (1300) to (1700).
Vdd (5 V)
Vss (0 V)
1.3 ms 1.3 ms
20 ms
www.paralla x.com
stan dard serv o