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