So this is my first ever attempt at using an Arduino and I am trying to control two servos at once. I found code to rotate one and thought I could just duplicate the code for the other pin and servo but the compiler doesn't like it.
What is wrong with it and what is the correct way to code it?
int servopin =2;
int pulse = 1500;
int servopin =3;
int pulse = 1500;
void setup()
{
pinMode(2, OUTPUT);
Serial.begin(9600);
pinMode(3, OUTPUT);
Serial.begin(9600);
}
void loop()
{
digitalWrite(2, HIGH);
delayMicroseconds(pulse);
digitalWrite(2, LOW);
delay(20);
digitalWrite(3, HIGH);
delayMicroseconds(pulse);
digitalWrite(3, LOW);
delay(20);
}