I am able to move three servos simultaneously with/without servo libraries. Everything changed after I used the Serial.Begin(9600) statement.
Arduino
3xSG90 (connected to an external PSU)
int PIN_SERVO1=1;
int GRA1_SER1=0;
int GRA2_SER1=180;
void setup() {
}
void loop() {
Servo1 ();
}
void moverServo1 (int pin, int angulo)
{
pinMode(pin,OUTPUT);
pausa = angulo*2000.0/180.0 + 500;
digitalWrite(pin, HIGH);
delayMicroseconds(pausa);
digitalWrite(pin, LOW);
delayMicroseconds(250-pausa);
}
///////////////////////////////////////
void Servo1 ()
{
moverServo1(PIN_SERVO1, GRA1_SER1);
delay(100);
moverServo1(PIN_SERVO1, GRA2_SER1);
delay(100);
}
After few changes to the above code, I have it working flawlessly with three servos. My problem resides after adding:
void setup(){
Serial.begin(3600);
}...
only one servo works. So, I am assuming that opening the serial port affects the PWM signals sent out to the servos. I really need the serial port for my project. Is this a close assumption?
Note: I used a similar code using a servo library with the same results. Serial port conflicted when more than one servo running.
Thanks