Log in

View Full Version : Servo motor isn't working


Charlie675
24-03-2011, 18:03
We are trying to get a servo to work and it won't even move. We've tried different servos and different PWM ports, but nothing happens. We are currently using this piece of code to test the servo:
Servo servo(4,8);
float servoRange = servo.GetMaxAngle() - servo.GetMinAngle();
for (float angle = servo.GetMinAngle(); angle < servo.GetMaxAngle(); angle += servoRange / 10.0) {
servo.SetAngle(angle); // set servo to angle
printf("%f\n",servo.GetAngle());
Wait(1.0); // wait 1 second
}
Any suggestions?

Robby Unruh
24-03-2011, 18:26
.. Is there a jumper attatched?

Travis Hoffman
24-03-2011, 18:28
.. Is there a jumper attatched?

Specifically, the jumper that should be installed on the 2 pins situated right next to your servo's PWM output on the Digital Sidecar?

Newo95
24-03-2011, 18:35
Also, how new is the actual pwm wire as these have a tendancy to wear out and can sometimes become unable to conduct.

Charlie675
24-03-2011, 23:45
Thanks, we did put the jumper in and we tried a few different servos but I'll keep replacing parts and see if anything works.

Robby Unruh
25-03-2011, 07:54
Can Servo's be set to floats? I thought it was only doubles.

try this code:

Servo servo(4,8);
double servoRange = servo.GetMaxAngle() - servo.GetMinAngle();
for (double angle = servo.GetMinAngle(); angle < servo.GetMaxAngle(); angle += servoRange / 10.0) {
servo.SetAngle(angle); // set servo to angle
printf("%f\n",servo.GetAngle());
Wait(1.0); // wait 1 second