Datasheet

Using Feedback
If a servo motor does what it is to ld to do, why do we need feedback?
RC servos usually do what they are told to do, but there are many cases where a servo motor
might not. These can include:
Insufficient motor size
Insufficient power supply
Physical interference
Electrical interference
loose connection
In these cases, feedback could alert you to the problem.
But even if the servo is adequately sized and functioning normally, it still takes some time to
respond to a position command, and in many applications it is just as important to know when
the position is reached.
This following code snippet is from the "Sweep" example in the Servo library. Note the arbitrary
15 millisecond delay after
"myservo.write(val)".
Without feedback, most servo programming has to make some assumptions about how long a
particular move will take. Adding fixed-time delays to servo code works OK for simple
applications, but can result in slow and/or jerky performance when trying to coordinate multiple
servo motions or interactions between servos and other sensors or actuators.
Or worse: If the delays are not long enough, your servos may not reach the desired position in
time. This can cause malfunctions and/or damage to your project. Timing problems are a big
problem in battery-powered projects because the motors will run slower as the battery power
fades.
void loop()
{
val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo position according to the scaled value
delay(15); // waits for the servo to get there
}
© Adafruit Industries http://learn.adafruit.com/analog-feedback-servos Page 6 of 12