Рет қаралды 4,843
código un semáforo doble paso a paso.
int rojo = 12;
int amarillo = 11;
int verde = 10;
int rojo2 = 9;
int amarillo2 = 8;
int verde2 = 7;
void setup()
{
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(9, OUTPUT);
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
}
void loop()
{
digitalWrite(verde, HIGH);
digitalWrite(rojo2, HIGH);
delay(5000);
digitalWrite(verde, LOW);
digitalWrite(rojo2, LOW);
delay(300);
digitalWrite(verde, HIGH);
digitalWrite(rojo2, HIGH);
digitalWrite(amarillo, HIGH);
delay(300);
digitalWrite(verde, LOW);
digitalWrite(rojo2, LOW);
digitalWrite(amarillo, LOW);
delay(300);
digitalWrite(verde, HIGH);
digitalWrite(rojo2, HIGH);
digitalWrite(amarillo, HIGH);
delay(300);
digitalWrite(verde, LOW);
digitalWrite(rojo2, LOW);
digitalWrite(amarillo, LOW);
delay(300);
digitalWrite(rojo, HIGH);
digitalWrite(verde2, HIGH);
delay(5000);
digitalWrite(rojo, LOW);
digitalWrite(verde2, LOW);
delay(300);
digitalWrite(rojo, HIGH);
digitalWrite(verde2, HIGH);
digitalWrite(amarillo2, HIGH);
delay(300);
digitalWrite(rojo, LOW);
digitalWrite(verde2, LOW);
digitalWrite(amarillo2, LOW);
delay(300);
digitalWrite(rojo, HIGH);
digitalWrite(verde2, HIGH);
digitalWrite(amarillo2, HIGH);
delay(300);
digitalWrite(rojo, LOW);
digitalWrite(verde2, LOW);
digitalWrite(amarillo2, LOW);
delay(300);
}