Arduino LED Light Box

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/

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: 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)

Step 2: The Place That You Need to Put LED Lights

Step 3: Let the Arduino and Breadboard Connect Together

Step 4: 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...

Step 5: Try It

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

Step 7: Complete!

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    Discussions