This instructable will guide you through how to make a decision maker Arduino. With the press of a button, the LEDs will light up in a random pattern. After a few seconds, a single LED will be lit. This is the final decision made by the Arduino. I have a particular purpose for my final product, but it can be used for many things. Do you ever have trouble picking a place to eat after a long day of work? Place 7 options on the board and click the button. In seconds you will have your mind made for you! This instructable will help you build confidence by creating a circuit with LEDs and possibly introduce you to a new component, the pushbutton.
During the weekend you can usually find my husband and me at a friends’ house playing an assortment of games. Typically, there is a bit of a debate when deciding who is going to be “Player 1”. We always try to make it fair, but we play so many games/times that sometimes we lose track. It always seems that a couple of people are always starting our games. This inspired me to make a device that could help my group have a fair and easy way to “Pick-a-Player”. Typically, our “game night” crew has seven participants. For this reason, I created this decision-maker to have 7 LEDs but you can adjust it to your own needs. Just for fun, I would have each player decorate a small paper cap that could be put over the LED to remember which one is theirs.
This is a perfect project for a beginner coder who is looking to extend their thinking into slightly more intricate coding and circuits. As a beginner coder myself, I can find myself feeling overwhelmed by the complexity of physical computing. At the end of this tutorial, you will find comprehension and extension questions as a way to help build your knowledge of coding and create more understanding within this project. These types of questions often help me to realize that I know more than I assume. I hope they can do the same for you!
Step 1: Set Up Your Breadboard
Placing the LEDs
- Start by placing your 7 LED in a column on different rows, placing the anode (long leg) in the same direction. Remember this as you continue to build your circuit
- Using the 220 ohm resistors, place one leg of the resistor in the same row as the LEDs cathode (short leg). The other leg should connect to the - Rail.
- Place one end of the jumper wires in the row with the LED anodes. The other ends should be placed in pins 2, 3, 4, 5, 6, 7, 8 respectively.
- With another jumper wire, connect the - Rail to GND.
- Place the pushbutton with two prongs in the (e) column and two prongs in the f column.
- Stick one leg of the 1K ohm resistor into the same row as one of the prongs on the (e) side. Stick the other leg in the - Rail.
- In the same row as the resistor, stick one leg of a jumper wire with the other end placed in pin 12.
- Connect the pushbutton to a power source by placing a jumper wire in the same row as the other prong on the (e) side. The remaining end of the wire is placed in 5V.
Step 2: Write the Code
This project was inspired by a different decision-maker that can be found here. I made changes to meet my needs for my project idea.
Step 3: Give It a Try!
- Plug it in and press the button. This should start a random sequence on the LED, ending with one lit up for 10 seconds.
- If this doesn’t happen, it’s time to debug.
- Take a look at your breadboard and check that your circuit is connected.
- Check over your code for errors. I always recommend double-checking that you wrote the correct pin numbers.
Step 4: (optional) Comprehension and Extension Questions
- What line(s) set up the output pins?
- If you wanted to change the amount of LED lights used which lines would you need to edit? Why?
- How might you use a similar code to create a device to put players into two teams? Partners?
- If you wanted the random light show to last longer, how would you do that?