Hello!
Just a quick question, and there may be an easy answer to it, but I can't figure it out. I have two servos, and both of them are rotating 180 in the same direction. How do I get them to rotate in opposite directions? Here is my code:
#include <Servo.h>
Servo myservo;
Servo myservoe;
int pos = 0;
void setup() {
myservo.attach(9);
myservoe.attach(6);
#include <Servo.h>
}
void loop() {
for (pos = 0; pos <= 180; pos += 1) {
// in steps of 1 degree
myservo.write(pos);
delay(5);
myservoe.write(pos);
delay(100);//
}
for (pos = 180; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(5);
myservoe.write(pos);
delay(100);
}
}