I have this servo: http://www.ebay.com/itm/HOE-SEL-SG90-9-Gram-Micro-9g-Servo-For-RC-Airplane-Car-Boat-US-Sel-/151049686413?pt=US_Scissors_Shears&hash=item232b434d8d
I'm using it with this code:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
void setup()
{
myservo.attach(10); // attaches the servo on pin 10 to the servo object
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
}
}
When I run the code the servo just keeps twitching on and off. I've verified the connections and they're correct. If I move the servo by hand a small bit it begins to move then it starts twitching again. It seems that the issue is that it's not moving enough to get to the next tooth on the servo gear, so it is in an endless loop of moving a small bit and then springing back. I've checked the servo and the teeth are not stripped out. I've tried changing the degrees and the delay in the code and it didn't seem to help, but I appreciate any help offered and I'm open to suggestion.
Thanks, Michael