two servos on Arduino pins 9 and 10...one moves the other stays static

Hello,

I have connected to firgelli -I actuators directly to an Arduino Mega 2560. Power connections are from +5V and GND, and the signals go to pins 9 and 10. However when I run the code only the one connected to pin 10 works, the other has no movement. Could it be due to the low power to move both? Or am I missing anything? The code is supposed to move both servos from 0 to 180 degrees in steps of 1:

#include <Servo.h> 
 
Servo servo1;   
Servo servo2;
                
int pos1 = 0;     
int pos2 = 0;
 
void setup() 
{ 
  servo1.attach(9);   
  servo2.attach(10);
} 
 
 void loop() 
{ 
  for(pos1 = 0; pos1 < 180; pos1 += 1) 
  {                                  
    servo1.write(pos1);    
    delay(15);                      
  } 
  for(pos2 = 0; pos2 < 180; pos2 += 1)   
  {                                   
    servo2.write(pos2);    
    delay(15);                        
  }
  
  for(pos1 = 180; pos1>=1; pos1-=1)    
  {                                
    servo1.write(pos1);    
    delay(15);                       
  }
  for(pos2 = 180; pos2>=1; pos2-=1)    
  {                                
    servo2.write(pos2);    
    delay(15);                        
  } 
}

I would appreciate your help, feel like this is small mistake somewhere.

Swap the servos to see if it is a hardware/connection problem.

Hard to say which particular actuator you're using, but looking at the L12 series, the stall current is 450mA - far in excess of what the arduino can provide. Just as when using servos, a separate power supply is required. DOn't forget to connect the grounds.

Hi
Since you are not using the two servos simultaneously, if one of them is working, the other must work as well. Try using a different pin say for example 10 and 11. :slight_smile:

Chandra

nevermind...
one of the actuators was dead...thank you.
I bought stepper motors instead. will post on anew topic!?