Cant control servo

Hello everyone,im having trouble controlling my servo futaba s3003,im using arduino uno ,and when i upload the code,my comp gets crazy, arduino ide wont recognize the port of arduino uno,then it recognize it again,and so on,the servo wont work with the monitor,it moves on its own

this is the code

#include <Servo.h>
Servo myservo;
int pos1 =0;
int pos2 =90;
int pos3=180;

void setup(){
Serial.begin(9600);
myservo.attach(6);
Serial.print(“Send the servo’s position with 1,2 or 3”);

}

void loop(){

int posicion = Serial.read();

if (posicion==‘1’){

myservo.write(pos1);// 0 ° if I send 1

}else if(posicion==‘2’){
myservo.write(pos2); // 90° if I send 2
}else if(posicion==‘3’){
myservo.write(pos3); // 180° if I send 3
}

}

im connecting the servo to arduino uno only,without external power source,orange wire to 5v,brown to gnd,and yellow to pin 6 for signal.servo’s voltage is 4.8v-6v

[u]Never[/u] power a motor or servo from the Arduino. That is causing the problem, and you can even damage or destroy the Arduino.

Use a separate power supply for the servo (e.g. 4 X AA batteries) and connect the battery negative lead, servo negative lead and Arduino grounds together.

the servo's orange wire goes to the battery positive lead then? and the arduino is still connected to usb port?

The servo positive power lead goes to the positive battery terminal, while the Arduino is powered by something else. Always connect the grounds.

Thanks i ll give it a try