Simultaneous Servo issue

Hi,

I'm having trouble getting more than one servo to be controlled simultaneously (or close to it) by the arduino. My project will involve six servos, slowly sweeping in different patterns (with faces attached, in case yr wondering) but if I could get two going, I'd be delighted for the moment.

The way I imagined it was that I could, with the code in the right order, check servo1's position, move it one degree, check servo2's position, move it one degree and so on through a number of them but the code I'm using, adapted from the Sweep example of the servo library, either puts one servo at a time through it's entire sweep or, with other variations, only moves the first motor properly and intermittently moves the second a degree now and again.

I have, as with the Sweep example, been using a delay between degrees. I looked at another forum thread where another timing function was suggested but couldn't adapt the code fragment there either http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1269991181

Anyone have any suggestions? Thanks!

Post YOUR code.

Hi,

Here is a sample program for controlling upto 12 servos using an Arduino

http://rcarduino.blogspot.com/2012/01/can-i-control-more-than-x-servos-with.html

However, you will need to consider power as well for the reasons discussed and demonstrated here and here -

http://rcarduino.blogspot.com/2012/04/servo-problems-with-arduino-part-1.html

http://rcarduino.blogspot.com/2012/04/servo-problems-part-2-demonstration.html

You will need to modify the code quite a bit to get each servo to move at a different speed, but getting the number you want to move reliably first is a good step so have a good look at the three posts, particularly the power posts.

Duane B

rcarduino.blogspot.com

Suggestion:

– study the blink without delay code

– realize how slow the servos are compared to the MCU

You should be able to start all your servos in less time than 1 servo can turn 1 degree, with time to spare.