Standard Servo is screwing up?

For reasons I can't figure out, my standard servo will not go to the degrees that it's supposed to go. I used to be able to move my servo it within 1 degree, but now for some reason when I put any value into "servo.write" it seems to only want to go to 0 degrees and wreck it's gears.

Not that long ago I wrote a code for arduino which gives me servo positions in degrees. I used it for a robot and it worked very well. I took the servos off of my robot, and now for some reason that same program doesn't work.

This is the code I used on my robot,

#include <Servo.h>
 
Servo servo_0;
Servo servo_1;
Servo servo_2;
Servo servo_3; //define servos
Servo servo_4;
Servo servo_5;
Servo servo_6;
Servo servo_7;
  
 
void setup() 
{ 
  servo_0.attach(0);  // attaches the servo on pin 0 to the servo object 
  servo_1.attach(1);  // attaches the servo on pin 1 to the servo object
  servo_2.attach(2);  // attaches the servo on pin 2 to the servo object
  servo_3.attach(3);  // attaches the servo on pin 3 to the servo object
  servo_4.attach(4);  // attaches the servo on pin 4 to the servo object
  servo_5.attach(5);  // attaches the servo on pin 5 to the servo object
  servo_6.attach(6);  // attaches the servo on pin 6 to the servo object
  servo_7.attach(7);  // attaches the servo on pin 7 to the servo object
  servo_0.write(90);        // | <--------------------------------------- 
  servo_1.write(90);       // | <----------------------------------------
  servo_2.write(90);      // | <-----------------------------------------
  servo_3.write(90);     // ^ legs <----------Starting positions---------
  servo_4.write(90);    // v feet <--------------------------------------
  servo_5.write(90);   // | <--------------------------------------------
  servo_6.write(90);  // | <---------------------------------------------
  servo_7.write(90); // | <----------------------------------------------
  delay(5000);  
} 
  
void loop() 
{
  
//Individual Servo Control
 {
  servo_0.write(60);  
  servo_1.write(90);
  servo_2.write(90);    // movement 1
  servo_3.write(90);   // legs
  servo_4.write(65);  // feet
  servo_5.write(90);
  servo_6.write(90);
  servo_7.write(90);
  delay(0100);  
 }
  servo_0.write(60);  
  servo_1.write(90);  
  servo_2.write(60);     // movement 2
  servo_3.write(90);    // legs
  servo_4.write(90);   // feet
  servo_5.write(90);
  servo_6.write(115);
  servo_7.write(90);
  delay(0100); 
  {
  servo_0.write(120);  
  servo_1.write(90);
  servo_2.write(60);       // movement 3
  servo_3.write(90);      // legs
  servo_4.write(65);     // feet
  servo_5.write(90);
  servo_6.write(90);
  servo_7.write(90);
  delay(0100);
  }
  servo_0.write(90);  
  servo_1.write(90);     // movement 4
  servo_2.write(90);    // legs
  servo_3.write(90);   // feet
  servo_4.write(90);
  servo_5.write(30);
  servo_6.write(90);
  servo_7.write(30);
  delay(0100);  
 {
  servo_0.write(90);  
  servo_1.write(90);    // movement 5
  servo_2.write(90);   // legs
  servo_3.write(120);  // feet
  servo_4.write(90);
  servo_5.write(30);
  servo_6.write(90);
  servo_7.write(30);
  delay(0100); 
} 
  servo_0.write(50);  
  servo_1.write(120);    // movement 5
  servo_2.write(120);   // legs
  servo_3.write(50);   // feet
  servo_4.write(90);
  servo_5.write(90);
  servo_6.write(90);
  servo_7.write(90);
  delay(0100); 
  {
  servo_0.write(50);  
  servo_1.write(90);     // movement 6
  servo_2.write(120);   // legs
  servo_3.write(50);   // feet
  servo_4.write(90);
  servo_5.write(90);
  servo_6.write(90);
  servo_7.write(90);
  delay(0100); 
  }
}//loop

And this is the code I was using for my servos today, it's roughly the same code, and it's based on the same concepts.

#include <Servo.h>
 
Servo servo_0;
  
 
void setup() 
{ 
  servo_0.attach(4);  // attaches the servo on pin 0 to the servo object 
  delay(5000);  
} 
  
void loop() 
{
  
//Individual Servo Control
 {
  servo_0.write(15);  
  delay(1000);  
 }
  servo_0.write(30);  
  delay(1000); 
  {
  servo_0.write(45);  
  delay(1000);
  }
  servo_0.write(60);  
  delay(1000);  
 {
  servo_0.write(75);  
  delay(1000); 
} 
  servo_0.write(90);  
  delay(1000); 
  {
  servo_0.write(105);  
  delay(1000); 
  }
}//loop

What I'm not understanding is why did my servos work on my robot, with a nearly identical code, but now that they're separate, they only want to go left?? Am I missing something here? Can I calibrate standard servos?? Why are my servos only moving to 0 degrees and trying to grind their gears??

I unscrewed the servo horns to remove them, does that change anything? I wouldn't think so, but I figured I'd mention it.

Any ideas for what the issue is would be greatly appreciated.

How is your servo powered? It should NOT be drawing power from the Arduino 5v pin. That can cause strange things to happen when the servo draws too much current.

It would be a good idea to post a photo of a drawing showing how you have everything connected.

By the way you don't need all those { } . Just the one pair that go with void loop() { }

...R

servo_0.attach(4); // attaches the servo on pin 0 to the servo object

Your comment line suggests that your servo is connected to pin 0 .... whilst the command line say's pin 4.

Should it be
servo_0.attach(4); // attaches the servo on pin 4 to the servo object
OR
servo_0.attach(0); // attaches the servo on pin 0 to the servo object ...which makes more sense with the servo_0 designation.

So...
Is it possible that you have made a simple error and connected the servo to pin 0 but specified pin 4?

Robin2:
How is your servo powered? It should NOT be drawing power from the Arduino 5v pin. That can cause strange things to happen when the servo draws too much current.

It would be a good idea to post a photo of a drawing showing how you have everything connected.

By the way you don't need all those { } . Just the one pair that go with void loop() { }

...R

I'm powering my servo externally through a 6v AA battery pack

woodygb:
Your comment line suggests that your servo is connected to pin 0 .... whilst the command line say's pin 4.

Should it be
servo_0.attach(4); // attaches the servo on pin 4 to the servo object
OR
servo_0.attach(0); // attaches the servo on pin 0 to the servo object ...which makes more sense with the servo_0 designation.

So...
Is it possible that you have made a simple error and connected the servo to pin 0 but specified pin 4?

originally I did make it pin "0" for my servo, since I was having issues, I decided to change the pin to rule that out.

I used to be able to move my servo it within 1 degree, but now for some reason when I put any value into "servo.write" it seems to only want to go to 0 degrees and wreck it's gears.

You may need to check to see if the ground between the arduino ground and the external servo battery ground has not been lost.

I figured out that it was the power supply @_@ I honestly don't understand why. But if I run it through the arduino(please don't get all butthurt about this, it was just to test things) it works perfectly fine. Who would have known that something as simple as the power supply could mess up the ability to do things in degrees.

obito94:
the power supply could mess up the ability to do things in degrees.

The power supply may be faulty, but this is not an accurate way to describe the problem because degrees have nothing to do with it.

If you are really convinced that there is some connection with degrees (rather than just a general failure to perform) I suspect it is not the power supply but your wiring that is at fault.

In Reply #1 I asked you to post a photo of a drawing of your wiring. I think that would still be a good idea.

...R

I figured out that it was the power supply @_@ I honestly don't understand why. But if I run it through the arduino(please don't get all butthurt about this, it was just to test things) it works perfectly fine.

Did you check to verify you have the arduino and servo power supply properly grounded together like below?

servo-wire.jpg