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.