Paso 5: Haga su Blink LED!
Combina la función de retardo con la función loop nos permite crear un efecto parpadeante con el LED.
Esto lo haremos por una temporización de 1 segundo (1000 milisegundos) entre el LED de (alta) y el LED está apagado (bajo).
Vamos a utilizar una variable int llamada retraso por lo que podemos cambiar su valor sin tener que teclear los números una y otra vez en todas partes.
Ejemplo:
// variables
// variables
int GREEN = 3;
int DELAY = 1000;// basic functions
voidsetup()
{
// setup LED modes
// we're specifying that we're going to send information to this LED
pinMode(GREEN, OUTPUT);
}voidloop()
{
// High turns things on
digitalWrite(GREEN, HIGH);
delay(DELAY);
// low turns things off
digitalWrite(GREEN, LOW);
}
int DELAY = 1000;
// basic functions
voidsetup()
{
// setup LED modes
// we're specifying that we're going to send information to this LED
pinMode(GREEN, OUTPUT);
}voidloop()
{
// High turns things on
digitalWrite(GREEN, HIGH);
delay(DELAY);
// low turns things off
digitalWrite(GREEN, LOW);
}