This color sequence reaction game challenges players to memorize and repeat increasingly longer patterns of colored lights. Built around an Arduino Uno, the game uses four LEDs to display sequences, six buttons for player input, and a piezo buzzer for audio feedback as players progress through difficulty levels.
The guide includes a complete wiring diagram showing how to connect the LEDs and resistors to the Arduino outputs, wire the six tactile buttons to the input pins, and integrate the passive buzzer for sound effects. Assembly steps walk through the circuit layout, and the provided firmware handles all game logic including sequence generation, timing, win/loss detection, and difficulty progression.
Wiring diagram
Gather all the parts
Assemble it in 3 steps
1. Wire the four colored lights
Unplug USB. Connect D2, D3, D4 and D5 through separate 220 ohm resistors to the long legs of the red, green, blue and yellow LEDs, respectively. Connect all short legs to Uno GND.
2. Wire the six buttons
Place each button across the breadboard center gap. Connect one contact to GND and the opposite switching contact to its Uno pin: red D6, green D7, blue D8, yellow D9, Start D10 and Mode D11. Do not connect the buttons to 5V.
3. Connect the passive piezo buzzer
Connect the positive lead to D12 and the other lead to GND. Use the photo's pin assignment table, not the illustrated jumper paths. Leave the 5V rail disconnected.
Review all connections
1. Connections between "red" and "Arduino"
2. Connections between "r0" and "Arduino"
3. Connections between "green" and "Arduino"
4. Connections between "r1" and "Arduino"
5. Connections between "blue" and "Arduino"
6. Connections between "r2" and "Arduino"
7. Connections between "yellow" and "Arduino"
8. Connections between "r3" and "Arduino"
9. Connections between "redbutton" and "Arduino"
10. Connections between "greenbutton" and "Arduino"
11. Connections between "bluebutton" and "Arduino"
12. Connections between "yellowbutton" and "Arduino"
13. Connections between "startbutton" and "Arduino"
14. Connections between "modebutton" and "Arduino"
15. Connections between "piezo" and "Arduino"
Deploy the firmware
#include <Arduino.h>
const uint16_t preview[] = {850, 600, 350};
const uint16_t budgetPerColor[] = {2500, 1700, 1100};
const uint8_t goal[] = {6, 9, 12};
const uint8_t maxLength = 12;
uint8_t level, length, sequence[maxLength], step;
enum Phase { Menu, Show, Gap, Answer, Next, Result } phase = Menu;
uint32_t since;
bool seeded;
struct Button { bool raw, stable; uint32_t changed; } buttons[6];
void lightsOff() { for (uint8_t i = 2; i <= 5; ++i) digitalWrite(i, LOW); }
void modeLights() {
lightsOff();
for (uint8_t i = 0; i <= level; ++i) digitalWrite(2 + i, HIGH);
}
void cue(uint32_t now) {
lightsOff();
uint8_t color = sequence[step];
digitalWrite(2 + color, HIGH);
phase = Show;
since = now;
}
void roundStart(uint32_t now) { step = 0; cue(now); }
void finish(bool win = false) {
lightsOff();
tone(12, win ? 1300 : 220, 280);
if (win) for (uint8_t pin = 2; pin <= 5; ++pin) digitalWrite(pin, HIGH);
phase = Result;
}
void setup() {
for (uint8_t i = 2; i <= 5; ++i) pinMode(i, OUTPUT);
for (uint8_t i = 0; i < 6; ++i) {
pinMode((6 + i), INPUT_PULLUP);
buttons[i].raw = buttons[i].stable = digitalRead((6 + i));
}
pinMode(12, OUTPUT);
modeLights();
}
void loop() {
uint32_t now = millis();
uint8_t presses = 0;
for (uint8_t i = 0; i < 6; ++i) {
Button &b = buttons[i];
bool raw = digitalRead((6 + i));
if (raw != b.raw) { b.raw = raw; b.changed = now; }
if (b.raw != b.stable && now - b.changed >= 25) {
b.stable = b.raw;
if (!b.stable) presses |= 1 << i;
}
}
uint32_t elapsed = now - since;
switch (phase) {
case Menu: case Result:
if (presses & 32) {
level = (level + 1) % 3;
phase = Menu;
modeLights();
} else if (presses & 16) {
if (!seeded) { randomSeed(micros()); seeded = true; }
length = 3 + level;
for (uint8_t i = 0; i < length; ++i) sequence[i] = random(4);
roundStart(now);
}
break;
case Show:
if (elapsed >= preview[level]) {
lightsOff();
phase = Gap;
since = now;
}
break;
case Gap:
if (elapsed >= 180) {
if (++step < length) cue(now);
else {
step = 0;
phase = Answer;
since = now;
tone(12, 1500, 120);
}
}
break;
case Answer: {
uint32_t total = uint32_t(length) * budgetPerColor[level];
if (elapsed >= total) { finish(); break; }
uint8_t colors = presses & 15;
if (colors) {
if (colors != (1 << sequence[step])) { finish(); break; }
tone(12, 950, 65);
if (++step == length) {
if (length == goal[level]) finish(true);
else {
sequence[length++] = random(4);
tone(12, 1200, 200);
phase = Next;
since = now;
}
break;
}
}
break;
}
case Next:
if (elapsed >= 1000) roundStart(now);
break;
}
}Download project files
Remix this project
Make it yours in one click
Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.




