Introduction: Arduino "First Player" for Board Games
This project was inspired by the "first player" apps that my husband and I have used on our phones. We love playing board games and use "first player" apps to decide who goes first. I decided to try to make my own Arduino version and try to code it based on what I have been learning. The apps are fairly simple, they randomly choose which person will be first to play.
This project is designed to push a button (input) and then will randomly light up either a red or blue LED (output). Simply just choose your color, and if your LED lights up, you are the first to play the game! This first board is simple with only 2 LEDs, but you could very easily add in more LEDs and modify the code to pick a first player out of more players (e.g. if you want 4 players, add in 2 more LEDs).
This can also help you make decisions! Can't decide what Netflix show to watch? Assign each option a color and let this choose for you! Who is going to do the dishes tonight? Let it decide for you!
Hope you have fun with this.
This project is a good one for beginners who have some background knowledge of coding in C++.
- Arduino Uno or Sparkfun Redboard, etc.
- Computer and connecting USB cable
- 2 LEDS (I used red and blue)
- Connecting wires
- 1 push button
- 2 resistors
- Arduino Editor login online for code
Step 1: Set Up Circuit Board
Your first step is to hook up and create the circuits on your breadboard.
- Insert 2 LEDs and connect 2 jumper wires (I used red and blue). The positive longer side of my red LED (anode) is connected to pin 11. The blue LED is connected to pin 12.
- Insert 2 resistors to connect the negative shorter side (cathode) of each LED to the black vertical negative (-) column.
- Connect a black jumper wire from negative vertical column to ground.
- Add a button across the mid section of your breadboard. See picture to connect black wire to ground and yellow wire to pin 2.
- Plug in your board to your computer for power.
Step 2: Code Your Project
Here is a link to my code. Please see my //notes that explains each part of my code. This will help you edit it as you wish!
Step 3: Test It
Try it out! Plug in and upload your code. Here is a video to show how it should work.
Step 4: Optional - Extend Your Project
As mentioned before, some options to add on to this project to make it more advanced:
- Add more LED's for more "players" (e.g. if you have a 4 player game)
- Add more buttons (e.g. have everyone press a button)
- Change the delay time if desired
- Add a buzzer noise