Help to code servos SG-5010 and MG996R

Hello! I’m building a Bluetooth-controlled robot using Arduino. The base of the robot is already done and moves correctly when connected to my cellphone.

Now I’m working on the robot’s arm, but I can’t make the servos rotate precisely. I have 3 types of servos:
– 2 black servos (unknown model, lost the labels)
– 2 SG-5010
– 1 MG996R

All of them rotate continuously (360° freedom). I’m trying to make them move to specific angles for my arm’s joints. I tested them with a potentiometer using a general servo control code from the internet. However, they all behave the same way: when the potentiometer is at the maximum value, the servo spins clockwise at full speed; when it’s at the minimum, it spins counterclockwise.

I also tested a standard SG90 servo, and it works correctly — it moves to specific positions based on the potentiometer value.

So I’m wondering: can these servo models (MG996R and SG-5010) be used for angular position control, or are they only continuous rotation servos? Any help would be appreciated!

#include <Servo.h>

const int potPin = A0;

int previousValue = 0;
int currentValue = 0;
int servoPin = 2;

Servo myservo;

void setup() {
  Serial.begin(9600);
  myservo.attach(servoPin);
  pinMode(potPin, INPUT);
}

void loop() {
  currentValue = analogRead(potPin);

  if (currentValue != previousValue) {
    Serial.println(currentValue);
    previousValue = currentValue;
    int output = map(currentValue, 0, 1023, 0, 120);
    myservo.write(output);
  }
}

Im using now an Arduino Mega and a basic potenciometer. Im really novice in arduino programming and projects

As far as I know, you can't control the position of continuous rotation servos, only their speed and direction.

Uhm, I got it. So I probably need other servo models — they can’t have 360° freedom. They should be like the common blue servos, limited to 180°, so I can use them properly in my robot arm.

Some servo motors have 2 versions - a version with 360 degree rotation and with limited angle rotation. I recently came across servos that are programmed to choose which of these 2 modes to work. I don't have any and I haven't used them but they look interesting to me and you can take a look at them. They are controlled differently (not with PWM but with a serial connection) but over 120 devices can be conveniently connected in series.