*/
// Pin 13 has an LED
connected on most Arduino boards.
// codigo para un semáforo.
int ledrojo = 6;
int ledverde=13;
int ledamarillo=10;
// the setup routine
runs once when you press reset:
void setup() {
// initialize the
digital pin as an output.
pinMode(ledrojo,
OUTPUT);
pinMode(ledverde,OUTPUT);
pinMode(ledamarillo,OUTPUT);
}
// the loop routine
runs over and over again forever:
void loop() {
digitalWrite(ledrojo, HIGH); // turn the LED on (HIGH is the
voltage level)
delay(5000);
// wait for a second
digitalWrite(ledrojo, LOW); // turn the LED off by making the
voltage LOW
delay(3000);
// wait for a second
digitalWrite(ledverde, HIGH);//
delay(5000);
digitalWrite(ledverde, LOW);
delay(3000);
digitalWrite(ledamarillo, HIGH);
delay(1000);
digitalWrite(ledamarillo, LOW);
delay(1000);
digitalWrite(ledamarillo, HIGH);
delay(1000);
digitalWrite(ledamarillo, LOW);
delay(1000);
digitalWrite(ledamarillo, HIGH);
delay(1000);
digitalWrite(ledamarillo, LOW);
delay(1000);
digitalWrite(ledamarillo, HIGH);
delay(1000);
digitalWrite(ledamarillo, LOW);
delay(1000);
digitalWrite(ledamarillo, HIGH);
delay(1000);
digitalWrite(ledamarillo, LOW);
delay(1000);
}