Introduction: How to Make a Led Dice

the led dice uses an Arduino randomizer to generate a number between 1 and 7, ever there an only 6 possible LEDs that will turn on at once this is due to clever wiring where some of the inputs overlapping.

Supplies

-7 led

- at least 40 jumper wire

- arduino (i use Leonardo)

-7 resistor 1 k omega

-bread board

-a button

Step 1: Making the Dice

wire the dice like the image above. with three pairs of LEDs that overlap and a single led that it's own with no overlap. the overlapping will involve a single output or a power source connected to two positives of a LED for each of the led connect a resistor.

Step 2: Programming

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){ delay (time); //改 digitalWrite (pinLed4, HIGH); delay (time); } if (ran == 2){ delay (time); //改 digitalWrite (pinLeds1, HIGH); delay (time); } if (ran == 3){ delay (time); digitalWrite (pinLeds3, HIGH); digitalWrite (pinLed4, HIGH); delay (time); } if (ran == 4){ delay (time); //改 digitalWrite (pinLeds1, HIGH); digitalWrite (pinLeds3, HIGH); delay (time); } if (ran == 5){ delay (time); //改 digitalWrite (pinLeds1, HIGH); digitalWrite (pinLeds3, HIGH); digitalWrite (pinLed4, HIGH); delay (time); } if (ran == 6){ delay (time); //改 digitalWrite (pinLeds1, HIGH); digitalWrite (pinLeds2, HIGH); digitalWrite (pinLeds3, HIGH); delay (time); } } digitalWrite (pinLeds1, LOW); digitalWrite (pinLeds2, LOW); digitalWrite (pinLeds3, LOW); digitalWrite (pinLed4, LOW); }

Step 3: Source

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

Step 4: What It's About?

the dice uses wire and interconnecting wires