Arduino LED Light Box

by erinstzu in Workshop > Tools

379 Views, 0 Favorites, 0 Comments

Arduino LED Light Box

IMG_5405.jpeg

The product completed film:

Supplies

This product is original by Davied311.

I've changed a few things that Davied311 doesn't have.

The lights will change at random.

This is a light dice, hope you guys will like it:)

The original web:

https://www.instructables.com/id/Arduino-Led-Dice/

The Material You Need

LED lights (red)*7

Arduino

Breadboard

Power button

10K Resistor*1

220or330 resistor*7

Wires(I've used lots of.LOL)

The Place That You Need to Put LED Lights

IMG_4909.JPG
IMG_7925.JPG

Let the Arduino and Breadboard Connect Together

IMG_6259.jpeg
IMG_7908.JPG
IMG_7412.JPG
IMG_4450.JPG

Code

int pinLeds1 = 10;

int pinLeds2 = 9;

int pinLeds3 = 7;

int pinLed4 = 8;

int buttonPin = 6;

int buttonState;

long ran;

int time = 2000;

void setup ()

{

pinMode (pinLeds1, OUTPUT);

pinMode (pinLeds2, OUTPUT);

pinMode (pinLeds3, OUTPUT);

pinMode (pinLed4, OUTPUT);

pinMode (buttonPin, INPUT);

randomSeed(analogRead(0));

}

void loop()

{

buttonState = digitalRead(buttonPin);

if (buttonState == HIGH){

ran = random(1, 7);

if (ran == 1){

digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 2){

digitalWrite (pinLeds1, HIGH);

delay (time);

}

if (ran == 3){

digitalWrite (pinLeds3, HIGH);

digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 4){

digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds3, HIGH);

delay (time);

}

if (ran == 5){

digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds3, HIGH);

digitalWrite (pinLed4, HIGH);

delay (time);

}

if (ran == 6){

digitalWrite (pinLeds1, HIGH);

digitalWrite (pinLeds2, HIGH);

digitalWrite (pinLeds3, HIGH);

delay (time);

}

}

digitalWrite (pinLeds1, LOW);

digitalWrite (pinLeds2, LOW);

digitalWrite (pinLeds3, LOW);

digitalWrite (pinLed4, LOW);}

https://create.arduino.cc/editor/Singularity1230/9...

Try It

IMG_6249.jpeg
IMG_6250.jpeg
IMG_6256.jpeg

Put It Into Your Own Box(This Is Not the Step You Must Do)

IMG_9163.jpeg

Complete!

IMG_4427.jpeg
IMG_3482.jpeg
IMG_5405.jpeg