Controlling speed of servos

I am having trouble controlling the speed of my servos. When I run my code without changing the speed, it works fine. But when I change the speed, it gets stuck in an infinite sub loop. Is there something about the speed that needs to be like a multiple of the change in position or it will end up between steps and always moving or do I have some other problem with my code? See code below.

50 1 speed
50 2 speed
50 4 speed
begin
4000 1 servo 4000 2 servo 4000 4 servo # set servo 0 to 1.00 ms
moving_wait
9000 1 servo 8000 2 servo 4000 4 servo # 1.25 ms
moving_wait
5000 1 servo 6000 2 servo 8000 4 servo # 1.50 ms
moving_wait
7000 1 servo 7000 2 servo 7000 4 servo # 1.75 ms
moving_wait
4000 1 servo 4000 2 servo 8000 4 servo # 2.00 ms
100 delay
repeat

sub moving_wait
begin
get_moving_state
while
# wait until it is no longer moving
repeat
return

Hello.

I see that you are setting servo 1 to 9000 (2250 microseconds), which is probably greater than the “Max” setting for that channel. On the Maestro, all channels have a max of 8000 by default. On the Micro Maestro, but not the Mini Maestros, setting the target of a channel to a value outside of its allowed range can result in the behavior you are seeing. I suggest you set it to 8000 or below. If that does not work, can you please specify which Maestro you are using and post your settings file?

- Jeremy

Thanks, I will try that.

I am using an Micro Maestro 6-channel servo controller.

pololu.com/catalog/product/1350

Is 1000 the minimum for this device?

Could you be more specific to which minimum you are referring to? You might find useful information in the Maestro user’s guide:

pololu.com/docs/0J40

- Jeremy