Community project

Color Sequence Reaction Game

Photo of Color Sequence Reaction Game

Bendit, Sean Allen B.

Published December 4, 2026

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

Loading diagram…

Gather all the parts

QtyComponent
1

LED

red

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

green

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

blue

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

1

LED

yellow

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

1

12 mm Tactile Push Button (Round Cap)

Momentary 12 x 12 mm four-leg through-hole tactile push button with a round cap. Closes a normally open contact while pressed; wire diagonally opposite legs between a digital input configured with INPUT_PULLUP and GND.

1

12 mm Tactile Push Button (Round Cap)

Momentary 12 x 12 mm four-leg through-hole tactile push button with a round cap. Closes a normally open contact while pressed; wire diagonally opposite legs between a digital input configured with INPUT_PULLUP and GND.

1

12 mm Tactile Push Button (Round Cap)

Momentary 12 x 12 mm four-leg through-hole tactile push button with a round cap. Closes a normally open contact while pressed; wire diagonally opposite legs between a digital input configured with INPUT_PULLUP and GND.

1

12 mm Tactile Push Button (Round Cap)

Momentary 12 x 12 mm four-leg through-hole tactile push button with a round cap. Closes a normally open contact while pressed; wire diagonally opposite legs between a digital input configured with INPUT_PULLUP and GND.

1

12 mm Tactile Push Button (Round Cap)

Momentary 12 x 12 mm four-leg through-hole tactile push button with a round cap. Closes a normally open contact while pressed; wire diagonally opposite legs between a digital input configured with INPUT_PULLUP and GND.

1

12 mm Tactile Push Button (Round Cap)

Momentary 12 x 12 mm four-leg through-hole tactile push button with a round cap. Closes a normally open contact while pressed; wire diagonally opposite legs between a digital input configured with INPUT_PULLUP and GND.

1

TDK PS1240 Passive Piezo Buzzer

Passive piezo driven by Arduino tone on a digital pin.

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"

FunctionredArduino
digitalANODE → Resistor P2EXT
groundGNDGND

2. Connections between "r0" and "Arduino"

Functionr0Arduino
digitalP1GPIO 2

3. Connections between "green" and "Arduino"

FunctiongreenArduino
digitalANODE → Resistor P2EXT
groundGNDGND

4. Connections between "r1" and "Arduino"

Functionr1Arduino
digitalP1GPIO 3

5. Connections between "blue" and "Arduino"

FunctionblueArduino
digitalANODE → Resistor P2EXT
groundGNDGND

6. Connections between "r2" and "Arduino"

Functionr2Arduino
digitalP1GPIO 4

7. Connections between "yellow" and "Arduino"

FunctionyellowArduino
digitalANODE → Resistor P2EXT
groundGNDGND

8. Connections between "r3" and "Arduino"

Functionr3Arduino
digitalP1GPIO 5

9. Connections between "redbutton" and "Arduino"

FunctionredbuttonArduino
digitalSIGNALGPIO 6
groundGNDGND

10. Connections between "greenbutton" and "Arduino"

FunctiongreenbuttonArduino
digitalSIGNALGPIO 7
groundGNDGND

11. Connections between "bluebutton" and "Arduino"

FunctionbluebuttonArduino
digitalSIGNALGPIO 8
groundGNDGND

12. Connections between "yellowbutton" and "Arduino"

FunctionyellowbuttonArduino
digitalSIGNALGPIO 9
groundGNDGND

13. Connections between "startbutton" and "Arduino"

FunctionstartbuttonArduino
digitalSIGNALGPIO 10
groundGNDGND

14. Connections between "modebutton" and "Arduino"

FunctionmodebuttonArduino
digitalSIGNALGPIO 11
groundGNDGND

15. Connections between "piezo" and "Arduino"

FunctionpiezoArduino
pwmSIGGPIO 12
groundGNDGND

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.

Open in Schematik