2 Servos need to be moving.

I need both servos to move at the same time. One CW the other CCW.

My code so far is as followed

#include <Servo.h> 
 
Servo right;
Servo left;
 
int pos = 0;
int posl = 0;
 
void setup() 
{ 
  right.attach(9);
  left.attach(10);
} 
 
void loop() 
{ 
  for(pos = 0; pos < 180; pos += 1)
  for(posl = 180; posl >= 1; posl -= 1)
  {
    right.write(pos);
    left.write(posl);
    delay(11);
  } 
}

If you want them both moving at the same time then you need only one loop with both servos getting updated values each time through the loop. Something like this:

for(servoPos = 0; servoPos <= 180; servoPos++)
  {
    right.write(servoPos);
    left.write(180 - servoPos);
    delay(11);
  }

Andrew

sweet. Thanks for the help, worked wonders!

How can I make it go forward only, right now it goes back also.

I guess you have a continuous rotation servo – that is it rotates in one direction as the angle is increased from 90 and the other direction when the angle is decreased. The actual direction forward or backward depends on how you have the servos attached. To do what you want, you can modify andrew's code so that the range is from 0-90 or from 90 to 180.

You may need to experiment to find the exact values.

If you are using continuous rotation servos , a google search for more information on these will help you understand how to use them