Author Options:

Simultaneous but different servo sweeps with four servos? Answered

Hi I want to run a sweep command for 4 servos off of one Arduino Uno simultaneously, but each at different rates.

Currently I have figured out how to run 4 servos simultaneously but at the same rate, and how to run each at a different rate, but not simultaneously.


1 Replies

steveastrouk (author)2011-08-03

Rate will only come by incrementing the positions at different rates.

I've written code to do this in the past, by treating the problem like drawing straight lines on a graph. The slope of the line is the rate, the X axis is time, and the Y axis is position. Then I used an old computer algorithm, for drawing lines, called "Bresenhams algorithm" to do the "drawing" - creating position step changes at the right rate.

See if you can make sense of the algorithm described in the link - its quite easy to implement, and you just need to put it in a loop, where you will increment a counter ('X') every time period, and use that to work your 'Y" values for each of your 4 servos.


Select as Best AnswerUndo Best Answer