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