9 in a Row, an Arduino LED Game.
This is a game where the goal is to hit the button when the green LED is on, 9 times in a row. This instructable will show you how to create this game from scratch.
Materials
-Arduino Uno (1)
-USB A-B Cable (1)
-Breadboard (1)
-4 LEDs (1 LED must be different from all others)
-Pushbutton Switch (1)
-560 ohm Resistors (6)
-10k ohm Resistor (1)
Wiring the LEDs
First provide 5v of power and ground to the breadboard via the Aruduino. Then wire the four LEDs to the Arduino through the 13-10 pins. The wire that connects the Arduino to the LED should be connected on the anode side of the LED (The longer of the two legs), and 560 ohm resistor should provide ground to the cathode side of each LED. Note that the LED that is connected to the 13th pin should be the LED that signals you to push the button. In my case, the green LED.
Wiring the Pushbutton
Place the pushbutton on the gap in the breadboard. Connect the push button to the 9th pin on the Arduino, and on the same side give it power. On the other side, provide ground with a 10k ohm resistor to the push button.
Wiring the 7 Segment Display
A 7 Segment Display has 10 pins in total with 5 on top and 5 on the bottom. The middle pins in both groups will be given power with a 560 ohm resistor. Using the photo labelling the 7 Segment Display, connect the letters to the corresponding pins on the Arduino: a to pin 2, b to pin 3, c to pin 4, d to pin 5, e to pin 6, f to pin 7, g to pin 8.
Coding the Arduino
In order to utilize the Arduino, you'll need to download the Arduino software which can be found here.
Download the attached Arduino Sketch file.
Plug in your Arduino to your computer.
Open the sketch in the Arduino software.
Upload the sketch to your Arduino.
Note that if you have different connection pins from me, you'll need to make the correct changes to to code.
If you'd like to change the difficulty of the game, there is a variable called "pause". By increasing the number you can give yourself more time, however if you'd like a harder challenge, then you can lower the number instead.
Other than that you're good to go!