Introduction: Arduino Lights

Picture of Arduino Lights

An arduino is an open source physical computing platform designed to make experimenting with electronics more fun. This instructable will teach you how to make a variety of patterns of flashing lights using your arduino and eight LEDs.

Ideally this would be done with the Vilros Ultimate Starting Kit for arduino, which contains all the necessary materials, hardware instructions, and a link to download the software instructions.

Step 1: Hardware

Attach the arduino and the breadboard to some sort of backboard that will hold them in place.

The starter kit comes with such a backboard. The arduino has holes for screws to hold it in place, and the breadboard has a sticky bottom covered by a removable plastic covering. Note that this is not necessary, but helpful.

Step 2: Hardware Continued

Picture of Hardware Continued

Plug in the wires, LEDs, and shift register into the Arduino and breadboard as shown above.

Note that the circle visible on one end of the shift register should be facing the nearest edge of the breadboard, and try to shove the shift register into the appropriate holes as one fluid action, instead of one connector at a time. The lower picture table details the location and plug in-points of every piece of hardware.

Additional note: the color of the LEDs is irrelevant; in fact having multiple colors can make the display more interesting.

Step 3: Software

Download/install the Arduino IDE software and Arduino Code to your computer.

If you are using the starter kit, flip to page 3 and follow the steps through page 8. If not, the IDE is available at arduino.cc/en/Main/Software. Getting the Arduino Code requires having the starter kit, but I've provided the necessary code in the next step.

Step 4: Software Continued

If you have the instruction guide in the starter kit, follow the instructions to download the software instructions from the website. If you do not have the starter kit, here's the code, but without the explanations provided by the original. Please support the official release.

Type these instructions into your Arduino sketch on your computer. Note: recommend not copying and pasting, as the format might change.

int datapin = 2;
int clockpin = 3; int latchpin = 4; byte data = 0;

void setup ()

{

pinMode(datapin, OUTPUT);

pinMode(clockpin, OUTPUT);

pinMode(latchpin, OUTPUT);

}

void loop()

{

//oneAfterAnother(); //All on, all off

//oneOnAtATime(); //Scroll down the line

//pingPong(); //etc

//randomLED();

//marquee();

//binaryCount();

}

void shiftWrite(int desiredPin, boolean desiredState)

{

bitWrite(data,desiredPin,desiredState);

shiftOut(datapin, clockpin, MSBFIRST, data); digitalWrite(latchpin, HIGH);

digitalWrite(latchpin, LOW);

}

void oneAfterAnother()

{

int index;

int delayTime = 100;

for(index = 0; index <=7; index++)

{

shiftWrite(index, HIGH); delay(delayTime);

}

for(index = 7; index >=0; index --)

{

shiftWrite(index, LOW);

delay(delayTime);

}

}

void oneOnAtATime()

{

int index;

int delayTime = 100;

for(index = 0; index <= 7; index++)

{

shiftWrite(index, HIGH);

delay(delayTime);

shiftWrite(index, LOW);

}

for(index = 7; index >= 0; index --)

{

shiftWrite(index, HIGH);

delay(delayTime);

shiftWrite(index, LOW);

}

}

void pingPong()

{

int index;

int delayTime = 100;

for(index = 0; index <= 7; index++)

{

shiftWrite(index, HIGH);

delay(delayTime);

shiftWrite(index, LOW);

}

for(index = 7; index >= 0; index--)

{

shiftWrite(index, HIGH);

delay(delayTime);

shiftWrite(index, LOW);

}

}

void randomLED()

{

int index;

int delayTime = 100;

index = random(8);

shiftWrite(index, HIGH);

delay(delayTime);

shiftWrite(index, LOW);

}

void marquee()

{

int index;

int delayTime = 200;

for(index = 0; index <= 3; index++)

{

shiftWrite(index, HIGH);

shiftWrite(index+4, HIGH);

delay(delayTime);

shiftWrite(index, LOW);

shiftWrite(index+4, LOW);

}

}

void binaryCount()

{

int delayTime = 1000;

shiftOut(datapin, clockpin, MSBFIRST, data);

digitalWrite(latchpin, HIGH);

digitalWrite(latchpin, LOW);

data++;

delay(delayTime);

}

Step 5: Using

Plug in your arduino to the computer running the arduino software from step 2. The code contains six lines that have the "//" marking them as comments but can serve as code instructions. Simply delete the // from the pattern you want to create, and the software will treat it as an instruction when you click "upload". To switch between patterns, replace the // on the pattern you no longer want and delete the // on the pattern that you do want.

Comments

seamster (author)2016-06-02

Very nice work, thanks for sharing!

About This Instructable

403views

4favorites

License:

More by Dread Pirate:Arduino Lights
Add instructable to: