problem with MG958 servo

Hello. Help me please.

i use MG958 high torque servo motor connect with arduino mega 2560 pin 39. And i have 4AA battery like this

this servo detail:

And code :

Buy servo can't turn left or right. It has only click sound .

thank for help.

Your batteries might not be powerful enough for that servo.

Try this code and let us know what the servo does and what you see in the serial terminal.

#include <Servo.h>

Servo myservo;
int pos = 0;
const int SERVO_MAX = 160;
const int SERVO_MIN = 20;

void setup()
  Serial.println(F("Beginning of program."));

void loop()
  Serial.println(F("From minimum to maximum."));
  for (pos = SERVO_MIN; pos < SERVO_MAX; pos++)
  Serial.println(F("From maximum to minimum."));
  for (pos = SERVO_MAX; pos > SERVO_MIN; pos--)
  Serial.println(F("Restarting Loop"));

I reduced the extremes so the servo isn't as likely to jam against the end stops.

High torque servo might need 2 or 3A to work, note.

now i use adaper 5V to power the servo. yes it work.

thank you for reply And help.