# How to change speed of multiple servos acting at the same time with PCA9685 module?

I'm using the PCA9685 module with its Adafruit library. In my code I have one object of the servodriver class that has 14 channels (controlling 14 servos basically).

void Positioning(){
ServoDriver.setPWM(right_foot, 0, MapRotation(rotations[0],"1"));
ServoDriver.setPWM(left_foot, 0, MapRotation(rotations[1],"2"));
ServoDriver.setPWM(right_calf, 0, MapRotation(rotations[2],"1"));
ServoDriver.setPWM(left_calf, 0, MapRotation(rotations[3],"2"));
ServoDriver.setPWM(right_thigh, 0, MapRotation(rotations[4],"1"));
ServoDriver.setPWM(left_thigh, 0, MapRotation(rotations[5],"2"));
ServoDriver.setPWM(right_pelvis, 0, MapRotation(rotations[6],"1"));
ServoDriver.setPWM(left_pelvis, 0, MapRotation(rotations[7],"2"));
ServoDriver.setPWM(torso, 0, MapRotation(rotations[8], "1"));
ServoDriver.setPWM(right_shoulder, 0, MapRotation(rotations[9], "1"));
ServoDriver.setPWM(left_shoulder, 0, MapRotation(rotations[10], "2"));
ServoDriver.setPWM(right_arm, 0, MapRotation(rotations[11], "1"));
ServoDriver.setPWM(left_arm, 0, MapRotation(rotations[12], "2"));
ServoDriver.setPWM(right_hand, 0, MapRotation(rotations[13], "1"));
ServoDriver.setPWM(left_hand, 0, MapRotation(rotations[14], "2"));
}


All the function positioning does is just set all the servos to a certain position (they're in a humanoid robot and so this position is for standing). The array rotations[] just contains the servo positions from 0 to 180 which is set elsewhere in the code for each servo respectively. The second argument for map rotation just maps it between the servos pulse min and max values (115 and 560) in normal order or reverse depending on number.

My question is how do I change the speed of the servos? I cannot use delay() or loops because wouldn't that cause all the servos to turn sequentially instead of all at once. a change in any rotations[] value indicates the robot is moving and so how do I make the servos slower instead of turning at their fastest to the new rotations[] positions whenever they are changed (as positioning() is called in the loop() function)?

You can solve this with delays, but if you want to move the servos at different speeds, you will need a non-blocking coding style like in the BlinkWithoutDelay example of the Arduino IDE (it was described countless times at this site and on the web).