Test Your Memory!
The Compact Memory Game is a DIY version of the legendary Simon game. It challenges players to remember and replicate increasingly long sequences of light and sound. It's an excellent project for beginners to learn about input handling, array management, and audio-visual feedback in Arduino.

The Rules of the Game
- The Sequence: The game starts by flashing one of the four colored LEDs randomly.
- The Turn: The player must press the button corresponding to that LED.
- The Expansion: If correct, the game plays the same sequence again but adds one new random step to the end.
- Game Over: If the player presses the wrong button, a "sad" tone plays, and the score is reset.
Hardware Components
This project is designed to be extremely portable, fitting easily on a mini breadboard.
- Arduino Nano: The compact brain of the operation.
- 4 Colored LEDs: Red, Blue, Green, and Yellow to represent the four notes.
- 4 Push Buttons: Tactile inputs for the player.
- Piezo Buzzer: Provides a unique tone for each color, helping the player memorize through sound.
- Resistors: 220-ohm for LEDs and 10k-ohm pull-down for buttons.

Code Highlights
The primary challenge in the code is managing the gameSequence[] array. The Arduino must keep track of the sequence generated so far and compare each button press from the user against the expected value at that position.
Using the tone() function, we assign a specific frequency to each LED:
- Red: 261Hz (Middle C)
- Blue: 329Hz (E)
- Green: 392Hz (G)
- Yellow: 523Hz (High C)
This creates a melodic experience that makes the game feel responsive and polished.