Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   Servo motor isn't working (http://www.chiefdelphi.com/forums/showthread.php?t=93986)

Charlie675 24-03-2011 18:03

Servo motor isn't working
 
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:
Code:

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

Re: Servo motor isn't working
 
.. Is there a jumper attatched?

Travis Hoffman 24-03-2011 18:28

Re: Servo motor isn't working
 
Quote:

Originally Posted by Robby Unruh (Post 1044817)
.. 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

Re: Servo motor isn't working
 
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

Re: Servo motor isn't working
 
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

Re: Servo motor isn't working
 
Can Servo's be set to floats? I thought it was only doubles.

try this code:
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



All times are GMT -5. The time now is 03:42.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi