jueves, 7 de abril de 2016

código semáforo

/*
  Parpadeo
  Se enciende un LED durante un segundo , luego se apaga durante un segundo , en repetidas ocasiones .

  Este código de ejemplo está en el dominio público .
 */

//Pin 13 tiene un LED conectado en la mayoría de las placas Arduino .
// give it a name:
int led = 13;
int ledamarillo = 12;
int ledrojo = 11;

//
la rutina de instalación se ejecuta una vez al pulsar RESET:
 () {              
  // inicializar el pin digital como salida.
  pinMode(led, OUTPUT);
pinMode(ledamarillo, OUTPUT);
pinMode(ledrojo, OUTPUT); 
}

//la rutina de bucle se ejecuta una y otra vez para siempre  () {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(10000);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(10);               // wait for a second

  digitalWrite(ledamarillo, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(ledamarillo, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  
    digitalWrite(ledamarillo, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(ledamarillo, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
  
     digitalWrite(ledamarillo, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);               // wait for a second
  digitalWrite(ledamarillo, LOW);    // turn the LED off by making the voltage LOW
  delay(100);       // wait for a second
 
  digitalWrite(ledrojo, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(10000);               // wait for a second
  digitalWrite(ledrojo, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);               // wait for a second
}

No hay comentarios:

Publicar un comentario