9g Tower Pro Servo Motor Problem

Hi, I am new to electronics and I have a problem. I have recently bought two 9g Tower Pro servo motors. when I try to run the sweep code, my servo just moves approximately 3-10 degrees every 1 second instead of large sweeping motions which the code was designed for. My laptop then makes a sound (that sounds like when I plug in a usb) every 1 second. I tried it with 2 servo and they react the same way. I have already made sure that the connections of the servo to the arduino uno are correct. I am looking forward to your reply! Thank you very much!

Please see the sweep code shown below:

#include <Servo.h>

Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created

int pos = 0; // variable to store the servo position

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

void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable ‘pos’
delay(15); // waits 15ms for the servo to reach the position
}
}

This is a pure guess since you didn’t provide a circuit, but are you powering the servo from the Arduino? Don’t do that, give it its own power supply and common the grounds

Edit: Zoomkat’s pic of how to do that, attached.

Thank you very much! I will try that.

Don’t be lulled by the Arduino 5v being enough for the motoer: that “usb sound” is probably the Arduino resetting, which is likely caused by the servo/s drawing too much current. As a rule of thumb, some members here budget 1A per servo: you need to allow for stall conditions not just free running. So yep, try my suggestion, and it will likely solve your problem.

I used the connection shown in this link (having trouble attaching pic. sorry):
http://www.google.com.ph/imgres?es_sm=93&espv=210&tbm=isch&tbnid=lvz6l9mVG9qvJM:&imgrefurl=http://arduino.cc/en/Tutorial/sweep&docid=mTucaUBaszr3MM&imgurl=http://arduino.cc/en/uploads/Tutorial/sweep_bb.png&w=473&h=270&ei=mN6nUrH6LYeDiQfVwoC4CQ&zoom=1&ved=1t:3588,r:13,s:0,i:116&iact=rc&page=1&tbnh=169&tbnw=297&start=0&ndsp=17&tx=170&ty=64

Thanks for the help guys. The replies in this forum seem to come in really fast haha.

The replies in this forum seem to come in really fast haha.

Time zones: there's likely to someone awake all the time.

lancecheng:
I used the connection shown in this link

The link is actually this one.

Very bad idea. Many Arduino "tutorials" very dodgy - unfortunately.

Use a separate source of 6V for the servo(s).

Dodgy indeed! Most servos have the power on the middle pin.