Servo Motor Not responding properly

I am connecting my servo with my arduino uno after connecting it with pin 9 and running the sweep program my motor is not functioning properly and laptop's producing sound like when it does when it encounters a unknown hardware and UNO's RED LED is blinking 3 times also my motor is fine as i have tested it with Due its working fine with it.....
What Could be the Problem?

The 5 cent question (the opposite end from the $64,000 question) - how is your servo powered? If it is powered from the Arduino that is probably the problem as it is likely to draw too much current.

If that is not the problem you will have to post the code you are using, and please read how to do so in the How To Use this forum sticky.

...R

My servo is powered from arduino uno and this is the code i’m using

#include <Servo.h> 
 
Servo myservo;  // create servo object to control a servo 
                // twelve servo objects can be created on most boards
 
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>=0; 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 
  } 
}

My guess is that you have a power problem. Try powering the servo from a separate 5v or 6v power supply and connect that power supply ground to the Arduino ground.

If that doesn't work draw a clear diagram showing how you have everything connected and post a photo of the drawing.

...R

The 5 cent question (the opposite end from the $64,000 question) -

Your dating yourself XD