Intro: Arduino Game, No Wiring! No Soldering!
NO Jumpers! NO Wires! NO Soldering! NO Breadboard!
Thinking outside the Box.
So you want to show off your micro-controller in concert with some add-on peripheral models really quickly, before friends or relative are on their way...
Put together this Fast&Easy version of a Simon "repeat after me" game in mere minutes. Albeit, monochromatic (with all red LEDs).
All that is required is to have these on hand: An Arduino microcontroller (preferably a Nano), a module with a set of LEDs, a 4 button module, and a buzzer, along with a rubber-band.
Step 1: Parts and Assembly
Nano 3.0 http://www.ebay.com/itm/131517734419 (<$3)
I recommend a small rubber-band, so you don't have to wrap it around a bunch of times to make it taut.
Other Arduinos can be used, but may require (or allow) different places of the peripheral modules; and as such pin assignment changes in the code used. The Nano 3.0 is especially good as it makes for a small assemble, easily held and operated with one hand.
Assembly is done by simply plugging in the modules and secure with the rubber-band. The 'active' piezo buzzer will only work if the polarity is hooked up correctly. Please note that it's (+) is inserted into D8, and the (-) to D11.
The Key module pins K4-K3-K2-K1-GND go directly into A1-A5. See image above.
The LED module pins GND-D1-D2-D3-D4-D5-D6 go directly into D7-D6-D5-D4-D3-D2-GND respectively.
Step 2: How It Works
The LED and Key modules are intended to normally have one pin connected to ground. To accommodate the direct attachment to the Nano this does not happen. So instead the pins connected to the 'GND's on these modules are operated as outputs and set 'LOW'. The MCU (MicroControllerUnit) will drive its outputs up to 30 ma. Which is plenty for the bank of four (4) LEDs. While it is far more then is needed for the buttons there is no harm as the outputs are current limiting (and they only draw current when pressed). The LED module has inline resistors further limiting the current which goes through each LED.
I updated and modified two different versions of the 'Simon' follow me lights and sound game to work with this project. Credits for the original versions are in the source listings.
One sketch (FastEasy_SimonSings) just uses an include file ('pitches.h' to be in the folder with it). While the other (FastEasy_SimonSays) uses the 'Tone' library. So you'll need one or both of those, depending on which sketch(s) you choose to use.
The library above should be part of the Arduino IDE by default. If not and you need some help with that here is How to Install a Library.
Step 3: Playing With the Assembly
Play is pretty straight forward. The code source files have some documentation in them. All you might really need to know is that the 'Simon Says' version auto starts with one flash. and the 'Simon Sings' version starts with a pattern of 4, but it awaits a key press before starting each round.
You'll likely find the LED and Key modules handy for doing other quick project proof of concepts. This project and the associated code will work with a speaker. It will sound better, but you'll not be able to do it without at least some jumpers.
Notice that as these sketches are coded, a Nano 3.0 or Uno will work (Plug-&-Play) directly, others may need to use different sets of pins due to their physical layouts; and possibly some code changes.