can't make both servos move at once.

Hi, i can't seem to get both servos to move at once. i am using a modified version of "sweep."

heres the code im using.

// Sweep
// by BARRAGAN <http://barraganstudio.com> 

#include <Servo.h> 
 
Servo myservo1;  // create servo object to control a servo 
Servo myservo2;                // a maximum of eight servo objects can be created 
int ledPin = 13;
int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservo1.attach(10,700,2400);  // attaches the servo on pin 9 to the servo object 
  myservo2.attach(9,700,2400); 
  
} 
 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservo1.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(5);                       // waits 15ms for the servo to reach the position 
  } 
    for(pos = 90; pos < 125; pos +=1)
  {
    myservo2.write(pos);
    delay(25);
  }
  for(pos = 125; pos>=60; pos-=1)
  {
    myservo2.write(pos);
    delay(25);
  }
  for(pos = 60; pos < 90; pos +=1)
  {
    myservo2.write(pos);
    delay(25);
  }
  
  for(pos = 180; pos>=1; pos-= 1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservo1.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(5);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 90; pos < 125; pos +=1)
  {
    myservo2.write(pos);
    delay(25);
  }
  for(pos = 125; pos>=60; pos-=1)
  {
    myservo2.write(pos);
    delay(25);
  }
  for(pos = 60; pos < 90; pos +=1)
  {
    myservo2.write(pos);
    delay(25);
  }
 
}

what am i doing wrong?

In what way does that code not work?

Those values are a little extreme and some servos may not be able to respond to 700us or 2400us

Try attach using :
myservo1.attach(10,1000, 2000);
myservo2.attach 9,1000, 2000;

If that still doesn't work and you are sure you have wired the servos correctly then try using external power for the servos

both servos work perfectly. But i can't get them to move at the same time. what i mean is, one servo swivels, while the other does nothing, when the one servo is done turning, the other starts it cycle.

i want both servos to move at the same time, but i cant get it to do that.

:edit: heres a video of whats going on. I want the top to move up and down while the bottom swivels back and forth.

You need to tell the servos to move at the same time if you want them to do that
Try this code in loop

void loop()
{
  for(pos = 0; pos < 180; pos += 1)  // goes from 0 degrees to 180 degrees
  {                                  // in steps of 1 degree
    myservo1.write(pos);              // tell servo to go to position in variable 'pos'
    myservo2.write(180 -pos);              // tell servo to go to position in variable 'pos'
    delay(5);                       // waits 15ms for the servo to reach the position
  }
    for(pos = 90; pos < 125; pos +=1)
  {
    myservo2.write(pos);
    myservo1.write(180-pos);
    delay(25);
  }
}

those look like beefy servos - you may need a seperate power source to move both of them at the same time.

thanks! ill try that soon. so far i haven't had any problems with running both servos at once, whenever i use the potentiometers to control them they have no problems at all