ddami
Published © MPL-2.0

5 Blinking LEDs

Simply, this is 5 LEDs in a row that blinks!

BeginnerShowcase (no instructions)61,331
5 Blinking LEDs

Things used in this project

Schematics

5 Blinking Leds

Code

5 Blinking Leds

Arduino
copy paste on arduino program
/*
  Blinking LEDs - test program to run 3 LEDs in a pattern of blinks
*/

int led1 = 0;
int led2 = 1;
int led3 = 2;
int led4 = 3;
int led5 = 4;

// the setup routine runs once when you press reset:
void setup() {                
  // initialize the digital pin as an output.
  pinMode(led1, OUTPUT);   
  pinMode(led2, OUTPUT);  
  pinMode(led3, OUTPUT);    
  pinMode(led4, OUTPUT);
  pinMode(led5, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led1, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(led1, LOW);    // turn the LED off by making the voltage LOW
  digitalWrite(led2, HIGH);    // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(led2, LOW);     // turn the LED off by making the voltage LOW
  digitalWrite(led3, HIGH);     // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(led3, LOW);      // turn the LED off by making the voltage LOW
  digitalWrite(led4, HIGH);     // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(led4, LOW);      // turn the LED off by making the voltage LOW
  digitalWrite(led5, HIGH);     // turn the LED on (HIGH is the voltage level)
  delay(80);                      // wait for 1/2 a second
  digitalWrite(led5, LOW);      // turn the LED off by making the voltage LOW
  delay(500);                     // wait for a second
}

Credits

ddami

ddami

3 projects • 10 followers

Comments