Skip to main content
deleted 31 characters in body
Source Link

I have two servos connected to an Arduino, They work fine if i write to them one by one so the wiring is all correct. I have seen a lot of examples here but none are facing the same issue. I have a simple for loop with Servo.write() on two servos (Facing each other) one going clockwise and the other going counterclockwise. I just want them to rotate at the same time and i cannot connect them to the same signal line since their movement is opposite. My Code Is:

 for(int pos = 0; pos < 90; pos += 2)  
 {      
     delay(200);        
     int pos7 = 90-pos;
     pos7 = pos7*(-1);           
     myservo6.write(pos);          
     myservo7.write(pos7);
 }

What Is Happening Both the servos go to the "same position" (if one is at 90 the other is at 0 etc.. ) Yet one goes there slow and the other goes super fast(not affected by delay). Even though my delay should affect both servos.

If i remove the delay they both go to the same position yet very fast. What i need is for them to move together slowly to the position.

ANSWER IS IN THE COMMENTS

I have two servos connected to an Arduino, They work fine if i write to them one by one so the wiring is all correct. I have seen a lot of examples here but none are facing the same issue. I have a simple for loop with Servo.write() on two servos (Facing each other) one going clockwise and the other going counterclockwise. I just want them to rotate at the same time and i cannot connect them to the same signal line since their movement is opposite. My Code Is:

 for(int pos = 0; pos < 90; pos += 2)  
 {      
     delay(200);        
     int pos7 = 90-pos;
     pos7 = pos7*(-1);           
     myservo6.write(pos);          
     myservo7.write(pos7);
 }

What Is Happening Both the servos go to the "same position" (if one is at 90 the other is at 0 etc.. ) Yet one goes there slow and the other goes super fast(not affected by delay). Even though my delay should affect both servos.

If i remove the delay they both go to the same position yet very fast. What i need is for them to move together slowly to the position.

ANSWER IS IN THE COMMENTS

I have two servos connected to an Arduino, They work fine if i write to them one by one so the wiring is all correct. I have seen a lot of examples here but none are facing the same issue. I have a simple for loop with Servo.write() on two servos (Facing each other) one going clockwise and the other going counterclockwise. I just want them to rotate at the same time and i cannot connect them to the same signal line since their movement is opposite. My Code Is:

 for(int pos = 0; pos < 90; pos += 2)  
 {      
     delay(200);        
     int pos7 = 90-pos;
     pos7 = pos7*(-1);           
     myservo6.write(pos);          
     myservo7.write(pos7);
 }

What Is Happening Both the servos go to the "same position" (if one is at 90 the other is at 0 etc.. ) Yet one goes there slow and the other goes super fast(not affected by delay). Even though my delay should affect both servos.

If i remove the delay they both go to the same position yet very fast. What i need is for them to move together slowly to the position.

added 33 characters in body
Source Link

I have two servos connected to an Arduino, They work fine if i write to them one by one so the wiring is all correct. I have seen a lot of examples here but none are facing the same issue. I have a simple for loop with Servo.write() on two servos (Facing each other) one going clockwise and the other going counterclockwise. I just want them to rotate at the same time and i cannot connect them to the same signal line since their movement is opposite. My Code Is:

 for(int pos = 0; pos < 90; pos += 2)  
 {      
     delay(200);        
     int pos7 = 90-pos;
     pos7 = pos7*(-1);           
     myservo6.write(pos);          
     myservo7.write(pos7);
 }

What Is Happening Both the servos go to the "same position" (if one is at 90 the other is at 0 etc.. ) Yet one goes there slow and the other goes super fast(not affected by delay). Even though my delay should affect both servos.

If i remove the delay they both go to the same position yet very fast. What i need is for them to move together slowly to the position.

ANSWER IS IN THE COMMENTS

I have two servos connected to an Arduino, They work fine if i write to them one by one so the wiring is all correct. I have seen a lot of examples here but none are facing the same issue. I have a simple for loop with Servo.write() on two servos (Facing each other) one going clockwise and the other going counterclockwise. I just want them to rotate at the same time and i cannot connect them to the same signal line since their movement is opposite. My Code Is:

 for(int pos = 0; pos < 90; pos += 2)  
 {      
     delay(200);        
     int pos7 = 90-pos;
     pos7 = pos7*(-1);           
     myservo6.write(pos);          
     myservo7.write(pos7);
 }

What Is Happening Both the servos go to the "same position" (if one is at 90 the other is at 0 etc.. ) Yet one goes there slow and the other goes super fast(not affected by delay). Even though my delay should affect both servos.

If i remove the delay they both go to the same position yet very fast. What i need is for them to move together slowly to the position.

I have two servos connected to an Arduino, They work fine if i write to them one by one so the wiring is all correct. I have seen a lot of examples here but none are facing the same issue. I have a simple for loop with Servo.write() on two servos (Facing each other) one going clockwise and the other going counterclockwise. I just want them to rotate at the same time and i cannot connect them to the same signal line since their movement is opposite. My Code Is:

 for(int pos = 0; pos < 90; pos += 2)  
 {      
     delay(200);        
     int pos7 = 90-pos;
     pos7 = pos7*(-1);           
     myservo6.write(pos);          
     myservo7.write(pos7);
 }

What Is Happening Both the servos go to the "same position" (if one is at 90 the other is at 0 etc.. ) Yet one goes there slow and the other goes super fast(not affected by delay). Even though my delay should affect both servos.

If i remove the delay they both go to the same position yet very fast. What i need is for them to move together slowly to the position.

ANSWER IS IN THE COMMENTS

Source Link

Simple 2 Servo Synch

I have two servos connected to an Arduino, They work fine if i write to them one by one so the wiring is all correct. I have seen a lot of examples here but none are facing the same issue. I have a simple for loop with Servo.write() on two servos (Facing each other) one going clockwise and the other going counterclockwise. I just want them to rotate at the same time and i cannot connect them to the same signal line since their movement is opposite. My Code Is:

 for(int pos = 0; pos < 90; pos += 2)  
 {      
     delay(200);        
     int pos7 = 90-pos;
     pos7 = pos7*(-1);           
     myservo6.write(pos);          
     myservo7.write(pos7);
 }

What Is Happening Both the servos go to the "same position" (if one is at 90 the other is at 0 etc.. ) Yet one goes there slow and the other goes super fast(not affected by delay). Even though my delay should affect both servos.

If i remove the delay they both go to the same position yet very fast. What i need is for them to move together slowly to the position.