Introduction: Arduino LED Dice + Speaker
This is where I got my idea from:
What I changed:
- The little push button to a larger one
- Colors of LEDs
- Delay time for LEDs
- Adding a speaker
- Order of D pins, because the original settings could not work
Step 1: Intro
This project is called Arduino LED dice + speaker.
There are 7 LEDs with different colors, a button, and a speaker.
How it works:
When you press on the button, you would hear a sound from the speaker, and the LEDs would randomly choose a number from 1 to 6. After about a second, the LEDs would turn off and you could press the button again to choose another number. It is like the dice we use when playing board games.
The video above shows how it works, and the pictures display the look from different sides.
Step 2: Materials
Here are some materials needed for this project:
- Arduino & Breadboard
- 7x LEDs of any kind and colors
- 7x 220 or 330 Resistor (brown)
- 1x Push button
- 1x Speaker
- Some wires
Step 3: Get Started!
- Place the LEDs on your breadboard in the shape of "H (as shown in the diagram)
- Connect the cathodes (-) of all the LEDs to ground (-) with the resistors
- Connect the 4 groups of LEDs (as shown in the diagram)
- Connect the groups of LEDs to D pin (as shown in the diagram)
- Put the button on the breadboard and connect it to ground (+) with 10k ohm resistor, another side to D pin
- Put the speaker on the breadboard and connect it to ground (-) and to D pin
The dice should follow the rules:
For no.1 of the dice: lights up the LED 4
For no.2 of the dice: lights up the group 1
For no.3 of the dice: lights up the groups 3 and 4
For no.4 of the dice: lights up the groups 1 and 3
For no.5 of the dice: lights up the groups 1, 3 and 4
For no.6 of the dice: lights up the groups 1, 2 and 3
Step 4: Code
Here is the code for this project:
Step 5: Test It!
The last step is to try and test if your project works!
Here are some more pictures of my project: LED dice from 1 to 6.