Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
stannano
Published © Apache-2.0

Led Wave!

A simple beginner project that explains how leds work, and it can be easily expanded!

BeginnerFull instructions provided1,827
Led Wave!

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
Any board will work
×1
5 mm LED: Red
5 mm LED: Red
×5
Resistor 10k ohm
Resistor 10k ohm
×5

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Premium Male/Male Jumper Wires, 40 x 3" (75mm)
Premium Male/Male Jumper Wires, 40 x 3" (75mm)
Breadboard, 170 Pin
Breadboard, 170 Pin
any size will work

Story

Read more

Schematics

As I am not good at these the correct led amount is 5 from pin 9-13

Code

Untitled file

Arduino
int ledCount = 5;
int leds[] = {13, 12, 11, 10, 9};
int currentState[] = {HIGH, LOW, LOW, LOW, LOW};
int currentHighLed = 0;

void setup() {
for (int i = 0; i < ledCount; i++) {
pinMode(leds[i], OUTPUT);
}
}

void loop() {

for (int i = 0; i < ledCount; i++) {
digitalWrite(leds[i], currentState[i]);
}
currentState[currentHighLed] = LOW;
currentHighLed++;
if (currentHighLed >= 5) {
currentHighLed = 0;
}
currentState[currentHighLed] = HIGH;
delay(500);
}

Credits

stannano

stannano

5 projects • 3 followers

Comments