Simon Says Game (Hunter Young)

My group consisted of Nina, Will, and Graham. We decided to do an actual Simon Says style and decided to hide the neopixels themselves for a more unique aesthetic. We chose to make our game out of foam core, a breadboard, an arduino board, and 4 neopixel strips. The game itself acts as a regular Simon Says games except it starts with a pattern of 5 lights and then adds an additional light with every correct repetition. If the user messes up, all the lights will flash and you will have to start over from where you left off. To reset the game entirely, simply unplug it and plug it back in.

For the input and outputs on our project, we used 4 buttons along with 4 corresponding neopixel strips. Foam core circles on top of each button allowed for easier use as well as presented a signifier to know which button is for which color. The output was simply the pixels lighting up in correspondence with the sequence play through or the user pressing the buttons, as well as lighting up when the user is incorrect.

During the construction of the game, Graham and I worked on the wiring and buttons while Nina and Will designed the casing. The foam core used for the case was laser cut to allow for the interconnecting design. The circuit didn’t require the use of a mux or shift register since we didn’t need a ton of pins. As for the wiring, we cut trenches and holes in the top piece to allow for installation of the buttons and lights. We also had to solder the neopixels and buttons to jumper wires to allow for them to connect to the breadboard. After the circuit was completed, we simply had to tape the neopixels into their slots, glue the buttons into the holes, and attach the top panel to the rest of the case.

if (currentState == START) {
for (int i = 0; i < 4; i++) {
if (pressed[i]) {
currentState = SEQ_DISPLAY;
seqPosition = 0;
seqTimer = currentTime;
break; //jumps out of the loop *Boing*
}
}
} else if (currentState == SEQ_DISPLAY) {
if (currentTime – seqTimer > DelaySequence) {

currentState = SEQ_OFF;
seqTimer = currentTime; //restart the timer
}
} else if (currentState == SEQ_OFF) {
if (currentTime – seqTimer > DelaySequence / 2) {
seqPosition++;
currentState = SEQ_DISPLAY;
seqTimer = currentTime;
if (seqPosition >= seqCount) {
currentState = USER_SELECT;
seqPosition = 0; //final exit state
}
}
} else if (currentState == USER_SELECT) {
int spot_on = currentSequence[seqPosition];
boolean got_it = (pressed[spot_on] == 1);
for (int i = 0; i < 4; i++) {
if (i != spot_on && pressed[i]) {
got_it = false; // you didn’t get it man.
currentState = START;

colorWipe(0, stripColors[0], 20); //Red
colorWipe(1, stripColors[1], 20); //Red
colorWipe(2, stripColors[2], 20); //Red
colorWipe(3, stripColors[3], 20); //Red

}
} if (got_it) { //You repeated the sequence correctly, now it gets harder.
currentState = USER_REPEAT;
seqTimer = currentTime;

The software itself was handled by Will and Nina. This is the main portion of the code that sets the mechanics of the game. It sets up and executes the sequences and waits for user feedback. When the user messes up, the game will read that a wrong button was pressed and the “screen” will flash and then wipe. When a button is pressed afterwards, the game will pick up from the failure point. if the player successfully repeats a sequence, the code adds in an additional output that expects the same input.

As far as difficulties that we faced, most were very minor. Graham and I had plenty of trouble trying to get the wires soldered to the neopixels. One of the lab assistants saved us with flux. Aside from that, the code was probably the hardest thing. With assistance from Dr. Hamid, Will was able to understand what exactly had to be done as was simply able to work his way through the software until it was how we wanted.

Leave a comment