Simon is a memory game, also known as Genius. This post shows how to make the game’s project with Arduino.
How Simon works?
For those who don’t know, it’s a game where to have to memorize the sequency the lights are turned on and press buttons to repeat this sequency. When more you get it correct, bigger becomes the light sequency to memorize. If you miss the sequency’s order, you lose.

Material list
- Arduino Mega 2560.

- Buzzer.
- 5 LEDs, each one on the following colors: red, yellow, green, blue and white.
- Resistors: 5 of 10kΩ, 2 of 220Ω, 2 of 150Ω and 3 of 100Ω.
- 5 push buttons.

- A 7-segments display with two digits. For being common cathode, 13 and 14 pins are connect to GND by 220Ω resistors.

Assembling the circuit
In this Simon version, there are 5 buttons for 5 colors. When you guess right a sequency, the two digit display increases score.

The buttons are in a pull-up configuration with 10kΩ resistors. This configuration is necessary to avoid floating values (between 0 and 5V).

Code and demonstration video
This algorithm uses many arrays, which numbers represent digital pins on Arduino.
int sequency[32] = {};//Array which indicates rounds' sequency. //32 is the maximum number.
int buttons[5] = { 53, 51, 49, 47, 45 };//Button array.
int leds[5] = { 52, 50, 48, 46, 44 };//Led array.
int tones[5] = { 262, 294, 330, 349, 395 };//Sound tones array.
int stage = 0;
int step = 0;
int pressed_button = 0;
bool game_over = false;
int buzzer = 42;
//Arrays of two digit display, each number is connected to a, b, c, d, e, f and g //segments respectively.
const int segmentPinsU[] = {28, 26, 27, 31, 33, 30, 29};
const int segmentPinsD[]={34, 32, 35, 37, 39, 38, 36};
//Arrays to show numbers on display.
const byte digitSegments[10][7] = {
{1, 1, 1, 1, 1, 1, 0}, // 0
{0, 1, 1, 0, 0, 0, 0}, // 1
{1, 1, 0, 1, 1, 0, 1}, // 2
{1, 1, 1, 1, 0, 0, 1}, // 3
{0, 1, 1, 0, 0, 1, 1}, // 4
{1, 0, 1, 1, 0, 1, 1}, // 5
{1, 0, 1, 1, 1, 1, 1}, // 6
{1, 1, 1, 0, 0, 0, 0}, // 7
{1, 1, 1, 1, 1, 1, 1}, // 8
{1, 1, 1, 1, 0, 1, 1} // 9
};
//Global variables to count score on display.
int count = 0;
int count2=0;
void setup() {
pinMode(52, OUTPUT); //Red led.
pinMode(53, INPUT); //Red button.
pinMode(50, OUTPUT); //Yellow led.
pinMode(51, INPUT); //Yellow button.
pinMode(48, OUTPUT); //Green led.
pinMode(49, INPUT); //Green button.
pinMode(46, OUTPUT); //Blue led.
pinMode(47, INPUT); //Blue button.
pinMode(44, OUTPUT); //White led.
pinMode(45, INPUT); //White button.
pinMode(buzzer, OUTPUT);
//Initiates with all segments turned off.
for (int i = 0; i < 7; i++) {
pinMode(segmentPinsU[i], OUTPUT);
digitalWrite(segmentPinsU[i], LOW);
pinMode(segmentPinsD[i], OUTPUT);
digitalWrite(segmentPinsD[i], LOW);
}
}
void loop() {
for (int i = 0; i < 7; i++) {//Start to count score.
digitalWrite(segmentPinsU[i], digitSegments[count][i]);
digitalWrite(segmentPinsD[i], digitSegments[count2][i]);
}
nextStage();
reproducesequency();
waitplayer();
//If game over, reset variables.
if (game_over == true) {
sequency[32] = {};
stage = 0;
step = 0;
game_over = false;
}
delay(1000);
}
void nextStage() {
int choose = random(5);//Choose randomly one of 5 leds.
sequency[stage] = choose;
stage++;
count++;
if(count==10){
count=0;
count2++;
}
if(count2==10){
count2=0;
}
}
void reproducesequency() {
for (int i = 0; i < stage; i++) {//A tone for each led.
tone(buzzer, tones[sequency[i]]);
digitalWrite(leds[sequency[i]], HIGH);
delay(500);
noTone(buzzer);
digitalWrite(leds[sequency[i]], LOW);
delay(100);
}
}
void waitplayer() {//Waits the player.
for (int i = 0; i < stage; i++) {
bool played = false;
while (!played) { //loop infinito.
for (int i = 0; i <= 4; i++) {
if(digitalRead(buttons[i])==LOW){
pressed_button=i;
tone(buzzer,tones[i]);
digitalWrite(leds[i],HIGH);
delay(300);
digitalWrite(leds[i],LOW);
noTone(buzzer);
played=true;
}
}
}
//Verify if the player got the sequency right.
if(sequency[step] != pressed_button){
for(int i=0;i<=4;i++){
digitalWrite(buzzer,HIGH);
digitalWrite(leds[i],HIGH);
delay(1000);
digitalWrite(leds[i],LOW);
digitalWrite(buzzer,LOW);
}
game_over=true;
count=0;
count2=0;
break;
}
step++;
}
step = 0;
}

