Flowing LED Lights With Arduino Leonardo

by ulandachen0509 in Craft > Digital Graphics

51 Views, 0 Favorites, 0 Comments

Flowing LED Lights With Arduino Leonardo

Colorful_Wall_Flashing_Lights_Preview.jpg

Signs often use colors and lights to grab people's attention, for example, traffic lights. My device presents a series of LED lights that light up and dim one after another. It performs a function of the commercial sign to grab the audience's attention as the lights quickly flash.

This work is inspired by the work: https://www.instructables.com/Flowing-LED-Lights-...

Improved Features

  1. Delay Time: The delay time was decreased to 50ms as faster light changes better grab people's attention,
  2. Appearance: A box was added to cover up the wires and the board for an attractive appearance. The box is colored in sections the same as the colors of the light to grab attention.
  3. Color of LED: The colors of the lights was changed into red, yellow, green, and blue.

Materials

A000057_featured_2.jpg
41CbCDccWLL.jpg
R30220S-2.jpg
s-l400.jpg
11026-Jumper_Wires_Standard_7in._M_M_-_30_AWG__30_Pack_-01.jpg

Arduino Leonardo * 1

Breadboard * 1

Resistor (as shown in the photo) * 8

LED * 8 (red, yellow, green, blue each * 2)

Jumper wires

Circuit

IMG_6538.jpg

Connect the circuits according to the pictures shown above:

- LED: long leg to D pins, short leg to resistors

- Resistors to negative (to GND)

*Note: D pins can be adjusted, select whichever pin you want.

Code

/**************************************/
const int lowestPin = 5;//the lowest one attach to
const int highestPin = 13;//the highest one attach to 
/**************************************/
void setup()
{
  //set pins 5 through 13 as output  
  for(int thisPin = lowestPin;thisPin <= highestPin;thisPin++)
  {
     pinMode(thisPin,OUTPUT); //initialize thisPin as an output
  }
} 
/****************************************/
void loop()
{
  //iterate over the pins
  //turn the led on from lowest to the highest
  for(int thisPin = lowestPin;thisPin <= highestPin;thisPin++)
  {
    digitalWrite(thisPin,HIGH);//turn this led on
    delay(50);//改wait for 50 ms 
  }
  //fade from the highest to the lowest
  for(int thisPin = highestPin;thisPin>=lowestPin;thisPin--)
  {
    digitalWrite(thisPin,LOW);//turn this led off
    delay(50);//改wait for 50 ms
  }
  for(int thisPin = highestPin;thisPin>=lowestPin;thisPin--)
  {
    digitalWrite(thisPin,HIGH);//turn this led on
    delay(50);//改wait for 50 ms
  }
  for(int thisPin = lowestPin;thisPin <= highestPin;thisPin++)
  {
    digitalWrite(thisPin,LOW);//turn this led off
    delay(50);//改wait for 50 ms
  }
}

Procedure

IMG_6538.jpg
Screen Shot 2021-04-18 at 16.34.14.png
IMG_6548.jpg

Step 1: Connect the circuit

Step 2: Copy the code given

Step 3: Make the box

Step 4: Upload the code and let them shine!

Final Product

Arduino 期中專題