As Moore's law states, processors have been getting faster. In turn, they are ale to process more, meaning that video games are getting more and more realistic. But as microcontrollers and the maker movement have been spreading, so have the number of microcontroller-based games that defy these realistic characteristic. The gold standard for this has been "Simon", which is common due to it's simplicity to build (four buttons, four LEDS). I wanted to build this on my breadboard, but I did not have four tactile switches at hand. I spent a lot of time thinking about how simple a game could get until I came up with the Simplest Game Ever. It only requires one button and one light emitting diode, so it is super easy to build. Essentially, the LED flashes at random intervals. You have to push the button whenever the LED lights to advance. The LED stays lit for shorter and shorter amounts of time as you progress, requiring lightning fast reactions until....you are unable to push the button on time so the game resets. The led blinks the score before you continue again. Simple, no? Then why not take five minutes and a few common parts and build it?
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Gather Parts
You will need:
- A breadboard
- >6 jumper wires
- 1 LED
- 1 momentary switch (pushbutton)
- 330 ohm resistor
- Prevents burnout of LED
- An Arduino
- I used my Leonardo, but any board that works with the Ardunio IDE will do.
- Computer with IDE, USB cable
- If you own an Arduino, you will probably have all of these
The few parts required can be salvaged from old electronics, found in a junk box, but they are so common almost any maker will have them sitting around. If not, they will only cost a little bit from any local or online electronics store.
Step 2: Build the Circuit
The circuit is fairly simple to build, just follow the image above.
- Connect pushbutton to breadboard, then tie one pin to the ground rail and connect the other to digital pin 8
- Connect the LED. Tie the side with the longer lead to the ground rail, and connect the other side with a 330 ohm resistor. Connect that to digital pin 9
- Connect the breadboard's ground rail to ground on the Arduino
- Connect digital pin 12 to the reset pin on the Arduino
You might be wondering why I did not include a 10k resistor and pullup the button to "HIGH" with 5 volts. That is because I use a nifty trick that allows you to use the internal pullup resistor on the Ardunio's atmega chip by declaring it in the code. This makes it so the circuit is simpler, giving it a greater chance of working the first time AND reducing cost.
The wire between 12 and reset allows the Arduino to reset itself when you lose the game.
Step 3: Upload the Code
Open the IDE, connect your arduino, select the correct serial port for upload, and download the code. Upload it to your board. It is simple so no additional libraries or IDE/board specific dependencies are needed.
Step 4: Code Explanation
The program declares the pins used. In the loop section, it turns the LED on, and scans for a button press while waiting. If a button press is detected, the LED is turned off, 10 seconds are subtracted from the LED on delay time, 1 point is added and a random delay starts. More notes can be found in the source.
Step 5: Play the Game!
If you connected everything properly, you should see the LED light once in awhile. If not, check your IDE upload messages and board connections. Feel free to comment if you need help.
Reset your board to start over. The LED should light. Press the game button button! Once you have done so, the LED will turn off and will light again at a random time between 0.5-8 seconds. Only next time the LED will be lit for a slightly shorter period. The game progressively gets harder until you mess up. Then, it pauses before flashing out your score (the number of times that you hit the button on time), fading slightly, and then resetting. Try again! It may not be painfully addicting but is simple.
Step 6: Next Steps
This game is basic, so it leaves lots of room for expansion or improvement.
- Want to see your score? Add a character display to view your progress real time, or use the serial monitor! (My Leonardo's LUFA serial was being buggy thus I could not do this)
- Not challenged? Speed up the game by changing the default starting delay, or add more buttons and LEDs! Hmm, I wonder how hard this game would be to play on an 8*8 grid....
- Bored? Add a speaker and compose your own theme music?
- Want to go even more minimal? The LED found on pin 13 on most Arduino boards could be used, and the reset button could be the game button. With some clever use of internal EEPROM, I'm sure this could work somehow.
- Want to carry the game around? Make a tiny PCB with the attiny 85 acting as the brain instead, and stare at the LED while your fellow subway passengers stare into their smartphone screens.
- Want a challenge? Try hacking the game onto already existing hardware. I would love to play this on my caps lock key on my keyboard, or on my computer's reset button.
- Want to test the reaction time of your other senses? Add a buzzer in place of the LED, or a MOSFET and motor.
- Want the game to be BIGGER? Add a big dome pushbutton with built in LED.
The possibilities are endless. Who knows, this game might end up being fun.