I thought I would try out the new CircuitPlayground developer board by writing a simple memory game similar to the old Simon game. It was fun so I though I would post it! I've attached the code.
Rules of the Original Simon Game
Game 1: Simon Says
For 1 or More Players
OBJECT: Repeat a longer and longer sequence of signals.
For a 1-Player Game
1. Press the GAME button. Press lens 1.
2. Press the LEVEL button. Choose a skill level and press the matching lens.
3. Press START
4. SIMON will give the first signal. Repeat the signal by pressing the same lens.
5. SIMON will duplicate the first signal and add one. Repeast these two signals by pressing the same lenses, in order.
6. SIMON will duplicate these first two signals and add one.
7. Continue playing as land as you can repeat each sequence of signals correctly. After the 5th, 9th, and 13 signals in a sequence, SIMON automatically speeds up.
8. If you fail to repeat a sequence exactly, or if you take more than 3 seconds to repeat a signal, SIMON responds with a RAZZ sound. This means you've lost, and the sequence of signals ends.
WINNING
Repeat the maximum number of signals for skill levels 1, 2, or 3, and SIMON will salute you with six short signals for the last lens you pressed. Repeat 31 ignals in skill level 4, and SIMON will congratulate you with a special SIMON SALUTE!
To play again, press START.
Board layout:
Top of the game is the USB connector.
GREED LED is at 10 oclock
YELLOW LED is at 8 oclock
BLUE LED is at 4 oclock
RED LED is at 2 oclock
Left push button is start
Right push button is level select
Pad 2 is the GREEN lens
Pad 0 is the YELLOW lens
Pad 6 is the BLUE lens
Pad 9 is the RED lens
E-note (blue, lower right); 659.25
C♯-note (yellow, lower left); 554.37
A-note (red, upper right). 440
E-note (green, upper left, an octave lower than blue); 329.23
TODO:
Find out how levels worked in the original game and document it
Implement levels
DONE:
Light an LED color RED, GREEN, YELLOW, and BLUE.
Respond to a capacitive touch.
Debounce capacitive touch.
Play a tone when the button is down.
Bright lens when pressed otherwise the lens glows dimly.
Respond to a button click.
Have the game play a random tone and light the led.
Send a signal and keep track of it.
Light the led when the cap is pressed.
Play the tone when the cap is released. Background play sounds bad.
Randomize all the signals in advance and store in array.
Timeout if the answer not recieved in the allowed time
Dougmeister wrote:What part of the code is looking for the "blue" capacitive button input? I just bought a Circuit Playground Express and no matter what I try, the blue button will not trigger. I suspect I may have a bad Playground Express...?