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