Hi,
OPs servo code;
/*
#include <Servo.h>
Servo servoLeft; //Define left servo
Servo servoRight; //Define right servo
*/
void setup() {
servoLeft.attach(2); //Set left servo to pin 10
servoRight.attach(3); //Set right servo to pin 9
}
void loop (){
for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees
// in steps of 1 degree
servoLeft(pos); // tell servo to go to position in variable 'pos'
delay(5000); // waits 5ms for the servo to reach the position
servoRight(pos);
delay(5000)
}
for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees
servoLeft(pos); // tell servo to go to position in variable 'pos'
delay(1); // waits 5ms for the servo to reach the position
servoRight(pos);
delay(1)
}
}
delay(5000); // waits 5ms for the servo to reach the position
Does not wait for 5ms,it waits for 5000ms, or 5s, while it waits, NOTHING is done, the program STOPs.
try
delay(100);
How are you powering the servos.
Can you please post a copy of your servo circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Thanks.. Tom... ![]()