I started this project some time ago in order to get familiar with Arduino.
I will provide you the code and the wiring instructions, if you have all the components ready it shouldn't take more than 30 minutes. This is also the first time I'm writing a guide on Hackster, if you think I'm wrong on some aspects or if you think it can be improved please leave feedback in the comment section.
Wiring InstructionsI use 1k pulldown resistors for the buttons, 100 ohm resistor for the Piezzo Buzzer and 330 ohm resistors for the LEDs. Start by putting on the buttons and the LEDs first, then add the resistors and finally add the jumper wires.
The following pins on the Arduino are used:/* Pin settings */
static const int Game::MICROPHONE_PIN = 12;
static const int Game::BLUE_PIN = 11;
static const int Game::RED_PIN = 10;
static const int Game::GREEN_PIN = 9;
static const int Game::YELLOW_PIN = 8;
static const int Game::BLUE_BUTTON_PIN = 7;
static const int Game::RED_BUTTON_PIN = 6;
static const int Game::GREEN_BUTTON_PIN = 5;
static const int Game::YELLOW_BUTTON_PIN = 4;
You can then customize the tone frequencies or the level seed. In the setup function:
randomSeed(0);
If you replace 0 with 1 then all the levels will be randomized, if you change it back to 0 then the game will play like before the change. In the video I also added a reset button which connects the Arduino's RST pin to GND.
CodeThe code is written in C++ and it uses classes, if you see this for the first time, don't be afraid, they're like containers for functions and variables. If you want to learn more search for a C++ tutorial on classes.
Improving the ProjectFeel free to improve this project however you like, you could perhaps use Arduino MKR1000 and make a wireless Simon Says game? That would be cool.
Comments
Please log in or sign up to comment.