I have an expert question. I'm using 20 servos with arduino mega and it works pretty well. But the servos should be driven parallel (yeah I know it's called serial port). So processing delivers 20 values and they are given serial to arduino which positions the servos one after each other (sounds horrible but it's a real small lag, but with 20 servos you see it). I was thinking about a implementation where processing sends all values and arduino recieves all and then positions the servos, or might the bottle neck be already between arduino and the servos? Greatful for any creative ideas to raise performance. Best SF
You could set the pulse high on all the servos at the same time set each servos pulse low dependent on the value for that servo. But each digitalWrite takes over 1 microsecond so if all the servos should be turned off at the same time there would be an error of over 25 microseconds for the 20th servo,
Another approach is to use the library here: http://www.arduino.cc/playground/Code/MegaServo
There is a constant in that source file called SERVOS_PER_TIMER, if you change this from 12 to 5, the code will run four timers in parallel each controlling 5 servos. This should be four times faster then you have now.