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.

asked Apr 5, 2013 at 22:49
0

1 Answer 1

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.

answered Apr 11, 2013 at 21:23

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.