recien empiezo a usar arduino y por alguna razon el led2 no funciona. No son las conexiones. Alguien me puede decir como correguir esto?
Gracias
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
int pos = 0; // variable to store the servo position
//-------
int led2 = 12;
int led3 = 13;
//-------
void setup()
{
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop()
{
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
digitalWrite(led3, HIGH); // turn the LED on (HIGH is the voltage level)
digitalWrite(led2, LOW);
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
digitalWrite(led3, LOW);
digitalWrite(led2,HIGH);
}
}