How can I change this code to get the servos moving in opposite directions at the same time?
// Sweep
// by BARRAGAN http://barraganstudio.com
// This example code is in the public domain.#include <Servo.h>
Servo myservo1; // create servo object to control a servo
Servo myservo2; // a maximum of eight servo objects can be createdint pos = 0; // variable to store the servo position
void setup()
{
myservo1.attach(9); // attaches the servo on pin 9 to the servo object
myservo2.attach(10); // attaches the servo on pin 10 to the servo object
}void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo1.write(pos);
myservo2.write(pos);
delay(15);
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo1.write(pos);
myservo2.write(pos);
delay(15);
}
}