ansh2919
Published © GPL3+

LED Sequencer

Use LEDs to make cool effects.

BeginnerProtip1,692
LED Sequencer

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
5 mm LED: Red
5 mm LED: Red
×3
5 mm LED: Yellow
5 mm LED: Yellow
×2
5 mm LED: Green
5 mm LED: Green
×2
Resistor 1k ohm
Resistor 1k ohm
×7
Jumper wires (generic)
Jumper wires (generic)
×15

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Circuit Diagram

Code

Code

Arduino
int ledArray[] = {2, 3, 4, 5, 6, 7, 8, 9};

int delayTime = 50;

void setup() {
  //initialise ledArray as outputs
  for (int i = 0; i < 10; i++) {
    pinMode(ledArray[i], OUTPUT);
  }
}

void loop() {
  //turn LEDs on from 0-7
  for (int i = 0; i <= 7; i++) {
    digitalWrite(ledArray[i], HIGH);
    delay(delayTime);
  }

  //turn LEDs off from 7-0
  for (int i = 7; i >= 0; i--) {
    digitalWrite(ledArray[i], LOW);
    delay(delayTime * 2);
  }
}

Credits

ansh2919

ansh2919

1 project • 7 followers

Comments