Servos motion not smooth

Hi,
im trying to program my servo to do a simple sweep (smooth motion).
but instead it jerks a small degree everytime.


the code i've used :

#include <Servo.h>

Servo myservo;  // create servo object to control a servo

void setup()
{
  myservo.attach(9);  // attaches the servo on pin 9 to the servo object
}

void loop()
{

  myservo.write(10);                  // sets the servo position according to the scaled value
  delay(1000);                           // waits for the servo to get there
  myservo.write(150);                  // sets the servo position according to the scaled value
  delay(1000);
}

Of course its not smooth. You have a full second delay before its allowed to take the next step. Have a look at the example sketches for the Servo library. The Sweep example smoothly sweeps the servo from 0 degrees to 180 degrees in 1 degree increments and back again. Try this sketch on your setup. Notice that the delay in each 1 degree step is only 15 milliseconds. You can adjust the parameters of the example to suit your needs. Just make changes to the For() loops.

In your sketch when you do:
myservo.write(10);
 
You making your servo jump 10 degrees from its start position. You next step then makes the servo jump 150 degrees from the last position it was in. For a smooth motion you need to use a for() loop like you see in the example sketch. 
fujiapple (author)  mpilchfamily5 years ago
i did try out the sample sweep code, but the result was the same.

it was working fine when i bought it from the shop, when i went home i took off the tip connectors and solder single core copper wires to them, though i dont see how this would affect the performance.

any ideas as what could be causing this ?

May have damaged the servo with too much heat when you soldered the new wires on.
fujiapple (author)  mpilchfamily5 years ago
yea i guess i must have damaged the driver,
the motor is working fine, so i turned it into a continuous motor instead.

thanks for the input!