|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
}
|
|
#2
|
|||||
|
|||||
|
Re: Servo motor isn't working
.. Is there a jumper attatched?
|
|
#3
|
||||||
|
||||||
|
Re: Servo motor isn't working
Specifically, the jumper that should be installed on the 2 pins situated right next to your servo's PWM output on the Digital Sidecar?
|
|
#4
|
||||
|
||||
|
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.
|
|
#5
|
|||
|
|||
|
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.
|
|
#6
|
|||||
|
|||||
|
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
Last edited by Robby Unruh : 25-03-2011 at 07:57. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|