servo do not stop rotating

hello every one !
a few days ago i bought 5 servos then i found that all of them have a problem
they do not stop rotating whatever was the code i use but they do not stop at all
but when i upload only this code they stop

#include <Servo.h>

const byte servoLeftPin = 11;
const byte servoRightPin = 9;
const int STOPPED = 1500;
 
Servo servoLeft;
Servo servoRight;
               
void setup()
{
  servoLeft.attach(servoLeftPin);
  servoRight.attach(servoRightPin);
  servoLeft.writeMicroseconds(STOPPED);
  servoRight.writeMicroseconds(STOPPED);
}
 
void loop()
{
 
 
}

but for the other codes or degrees they still only rotating
are they broken or they have other thing to do
because i heard about the continuous servo motor and i don’t know if they are

thanks for everyone

Writing 1500 microseconds is typically what needs done to stop a continuous rotations servo.
Writing a value lower that that rotates the servo one direction. Higher and the servo rotates the other direction.

Does your project need continuous rotation servos? Or are you planning on using standard servos toat move to s specified angle?

Yes it sounds like you have continuous rotation servos. If you wanted standard positional 180 degree servos you have bought the wrong thing.

What servos did you buy and where from? A link would be good. Perhaps you can send them back and get the correct version.

Steve

Below is some servo test code you can use to check your servos. If your servos keep rotating, you most likely have continuous rotation servos. The command value where the servo stops rotating can vary depending on the static position of the internal pot (or possibly voltage divider).

// zoomkat 7-30-10 serial servo test
// type servo position 0 to 180 in serial monitor
// for writeMicroseconds, use a value like 1500
// Powering a servo from the arduino usually *DOES NOT WORK*.

String readString;
#include <Servo.h> 
Servo myservo;  // create servo object to control a servo 

void setup() {
  Serial.begin(9600);
  myservo.attach(9);
}

void loop() {

  while (Serial.available()) {

    if (Serial.available() >0) {
      char c = Serial.read();  //gets one byte from serial buffer
      readString += c; //makes the string readString
      delay(3);
    } 
  }

  if (readString.length() >0) {
    Serial.println(readString);
    int n = readString.toInt();
    Serial.println(n);
    myservo.writeMicroseconds(n);
    //myservo.write(n);
    readString="";
  } 
}

vinceherman:
Writing 1500 microseconds is typically what needs done to stop a continuous rotations servo.
Writing a value lower that that rotates the servo one direction. Higher and the servo rotates the other direction.

Does your project need continuous rotation servos? Or are you planning on using standard servos toat move to s specified angle

thanks for your replay
my project don't need a continuous servo just i bought it without knowing
is there any way to control it to work like a normal servo ?

slipstick:
Yes it sounds like you have continuous rotation servos. If you wanted standard positional 180 degree servos you have bought the wrong thing.

What servos did you buy and where from? A link would be good. Perhaps you can send them back and get the correct version.

Steve

thanks for your reply
yes i think so , i bought the wrong thing
i bought a 360 degrees servo from slypro in algeria
https://www.sly-pro.com/shop-1/sg90-360-degrees-9g-micro-servo-motor-tower-pro

Unfortunately "360 degree" is often a code name for a continuous servo. And the feed back mechanism that allows control of the position has been removed to make it a continuous servo. So there is no way for it to act like a normal servo.

Steve

"is there any way to control it to work like a normal servo ?"

If the servo still has an internal pot, then you might be able to connect the pot shaft to the output gear with a drop of glue.

i ws thinking about add a potentiometer in the internal pot but i found that i can add it with a circuit just by connecting everything just like the non continuous servo
can that be possible ?

It depends, only you currently know what exact devices you have, you've not told us. Do you have a link
to the product page or specifications for them?

the link of the product is
https://www.sly-pro.com/shop-1/sg90-360-degrees-9g-micro-servo-motor-tower-pro

i am thinking that if the internal pot of the normal servo is like this in the photo

and it is the same of the continuous servo except the potentiometer because i searched and i found that the continuous servo don't have a potentiometer into so i should just add a potentiometer to the servo
is that right ?

"i ws thinking about add a potentiometer in the internal pot but i found that i can add it with a circuit just by connecting everything just like the non continuous servo
can that be possible ?

Below is a link to youtube videos on modifying 9g servos. By watching these videos you should be able to see how to open your servo up and see if it still has a pot inside it.

https://www.youtube.com/results?search_query=modify+servo+9g

thanks for you all
i found a way to make a continuous servo work like the normal servo