0

I have the following servo I would like to make a small self balancing robot with it. I am having trouble with figuring out how to control it with PWM using pulses to decide what position to move it and how much.

I am using the WiringPi library and am able to get the servo to rotate continuously I have followed this tutorial and am using the example code provided but when I enter the value of the desired position of the servo it will move the same amount every time regardless of entry and have narrowed down the problem to being the delay() in the code it is set by default to delay(1000) if I change the value to delay(500) it will rotate the servo less.

So basically it is ignoring all of the code above it. Can someone tell me if there is an error in the code? Also explain to me how to control this specific servo it seems in the tutorial he sets specific values for the specific servo he is using.

1

Continuous-rotation servos interpret the pulse width as a speed command, not a position command. (They're made from position servos by breaking the feedback loop.) So you're sending a command to rotate at a certain speed (based on the argument to the softPwmWrite() call), and then waiting for a little while in delay(), which is why the delay() call seems to control position.

If you actually want to command the servo to move to a fixed position and hold it, you want a non-continuous-rotation servo.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.