Este semáforo esta compuesto de: 1 arduino, 3 leds RGB, 3 Resistencias 220Ω

// C++ code
//
void setup()
{
  pinMode(11, OUTPUT);
  pinMode(10, OUTPUT);
  pinMode(9, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(2, OUTPUT);
}

void loop()
{
  digitalWrite(11, HIGH);
  delay(500); // Wait for 500 millisecond(s)
  digitalWrite(11, LOW);

  delay(500); // Wait for 500 millisecond(s)
  digitalWrite(10, HIGH);
  delay(400); // Wait for 400 millisecond(s)
  digitalWrite(10, LOW);
  delay(400); // Wait for 400 millisecond(s)
  digitalWrite(9, HIGH);
  delay(300); // Wait for 300 millisecond(s)
  digitalWrite(9, LOW);
  delay(300); // Wait for 300 millisecond(s)

  digitalWrite(8, HIGH);
  delay(200); // Wait for 200 millisecond(s)
  digitalWrite(8, LOW);
  delay(200); // Wait for 200 millisecond(s)
  digitalWrite(7, HIGH);
  delay(100); // Wait for 100 millisecond(s)
  digitalWrite(7, LOW);
  delay(100); // Wait for 100 millisecond(s)
  digitalWrite(6, HIGH);
  delay(50); // Wait for 50 millisecond(s)
  digitalWrite(6, LOW);
  delay(50); // Wait for 50 millisecond(s)

  digitalWrite(4, HIGH);
  delay(100); // Wait for 100 millisecond(s)
  digitalWrite(4, LOW);
  delay(100); // Wait for 100 millisecond(s)
  digitalWrite(3, HIGH);
  delay(100); // Wait for 100 millisecond(s)
  digitalWrite(3, LOW);
  delay(100); // Wait for 100 millisecond(s)
  digitalWrite(2, HIGH);
  delay(100); // Wait for 100 millisecond(s)
  digitalWrite(2, LOW);
  delay(100); // Wait for 100 millisecond(s)
}

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

You may also like