servo write

Hi all. I'm sure this is a simple question, but I'm needing to see how to modify the servo sweep program. I am trying to write a program for a robot claw but the standard servo write responds too quickly and ends up shaking it to pieces. Can anyone tell me how to either make the servo move more slowly or how to use sweep to fix the servo in a single position.

Please post your code whatever you have tried so far. And the rest of the details so it would be easy to help you out.

Try VarSpeedServo.h library instead of the standard Servo.h

Steve

Can anyone tell me how to either make the servo move more slowly

How do you walk slowly down a hall? Take a small step. Wait a while. Take a small step. Wait. Repeat as needed until you get where you are going.

You need to ditch sweep-type thinking and its for() approach.

If you haven't yet done so, embrace BlinkWithOutDelay thinking using millis(), as recently well explained in UKHeliBob's new tutorial here.

What's that got to do with servos you ask? Well as PaulS explained, you need to do a step at a time, and the time between one step and the next determines your rate of progress. That timing needs to be BWoD-like, so that your sketch can do other things without getting blocked.

One of the examples in the thread linked to fades an LED. It could just as well move a servo a number of steps with a non blocking "delay" between them.

kenwood120s:
You need to ditch sweep-type thinking and its for() approach.

If you haven't yet done so, embrace BlinkWithOutDelay thinking using millis(), as recently well explained in UKHeliBob's new tutorial here.

What's that got to do with servos you ask? Well as PaulS explained, you need to do a step at a time, and the time between one step and the next determines your rate of progress. That timing needs to be BWoD-like, so that your sketch can do other things without getting blocked.

The reason that this is important, in a claw application, is that you most likely do NOT want the claw to squash whatever it is trying to pick up. It needs to apply just enough pressure to grip the object. So, you need some way of knowing how much pressure is needed, of knowing how much pressure is being applied, and some way of sneaking up on the required pressure. That is done my moving the claw servo at various speeds - fast when the object to be picked up is far away, slowly when it is close.