Can we control other servos with common servo code Arduino I am trying to control MG996R using code for a typical servo (SG90)
I used an external power supply, 5V,2A
I connected the servo signal line to Arduino slot 7,
servo positive to external power supply positive,
servo ground to external power supply ground,
while leaving the Arduino power supply and ground unconnected.
I tried the below code.
it works for SG90, while MG996R is not moving at all.

#include &lt;Servo.h&gt;  
Servo myservo;


void setup()
{ 
  myservo.attach(7);  //pin 7 is the one control servo
 
} 

void loop() 
{  

  for (int pos=0; pos&lt;=60; pos++)
  {
    myservo.write(pos);
    delay(15);
  }

}


Is it because the different servos need different code?
They work with same control signal, so the same code should work for both of them
You need make sure the ground of servo is both connected with the Arduino ground and the power supply ground (power supply ground for power supply positive, Arduino ground for the signal line)
I think SG90 worked even not connecting the Arduino ground is because the difference in design.
But you should always connect Servo ground to the Arduino ground.