Would you explain a bit more about what you want to do?
I assume you'd like to move each servo a bit at a time.
If that's the effect you want, you do NOT want to use two for loops:
for(pos = 0; pos < 180; pos += 1)
{
for(pos2 = 180; pos2 > 0; pos2 -=1)
{
servo.write(pos);
servo2.write(pos2);
delay(25);
}
}
This will move servo 2 from 180 degrees to 0 after each 1 degree movement of servo, i.e. servo2 will move from 180 to 0, but 180 times for every time servo moves.
One way to think about the effect you want is to pretend you are making a "Wallace & Grommet" stop frame animation.
Each frame must contain the little bit of movement of each servo.
It may be that you want servo to get to it's final position before servo 2, so think of it as two scenes, one with both moving, and one with only servo2 moving.
I do this by planning the whole effect on a piece of paper.
To be fair, I usually convert the movements for each scene to some values in an array, and drive the whole thing from data, but let me focus on an approach.
So, if you want servo1 to move twice as fast as servo2:
#include <Servo.h>
Servo servo1; // create servo object to control a servo
Servo servo2; // create servo object to control a servo
int pos1; // angle of servo 1
int pos2; // angle of servo2
void setup()
{
servo1.attach(9); // attaches the servo on pin 9 to the servo object
servo2.attach(10); // attaches the servo on pin 10 to the servo object
}
void loop()
{
// Scene 1:
for (int i=0; i<45; i += 1) {
pos1 = 90 - i; // servo1 from 90 to 45 degrees
pos2 = 0 + (i*2); // servo2 from 0 to 90 degrees
servo1.write(pos1);
servo2.write(pos2);
delay(15); // waits for the servo to get there
}
// Scene 2
for (int i=0; i<60; i += 1) {
pos1 = 45; // servo1 doesn't move
pos2 = 90 + i; // servo2 from 90 to 150 degrees
servo1.write(pos1);
servo2.write(pos2);
delay(15); // waits for the servo to get there
}
}
Add as many scenes as you need.
Once you feel comfortable with this approach, you might like to try describing each scene as the few numbers that change at each frame. Then have a look at using arrays (of struct), and see if you can make a 'player' which can perform all the scenes based on the numbers. Then you can edit the whole 'movie' by adjusting a few numbers.
HTH
GB-)