Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsPlay the classic memory game: the board flashes a growing pattern of LEDs and you must repeat it exactly. The whole game lives in one array of up to thirty steps and a variable saying how many of them are in play. Each round appends one new random step and replays the lot, then waits for that many button presses. Giving every colour its own tone means players remember the melody as well as the lights, which is why the original game was so hard to put down.
Every part for this build comes in the Geekobot Explorer Kit box, a Geekobot exclusive, together with the parts for all 61 projects, from a first blinking LED to a smart fan and a reaction game. The wiring below is the kit's own wiring.
Tick anything you already have and the total updates.
The brain of every Explorer Kit project
Male-to-female and female-to-female leads for the modules
LEDs from the kit's red, green, yellow and blue packs
220 ohm resistors: one in series with every LED segment
Nano I/O shield from the kit: every pin has its own S, V, G header, so modules plug in with jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
explorer_kit_50_memory_sequence_game.inoVerify & upload in Electrolarkint ledPins[4] = {2, 3, 4, 5};
int buttonPins[4] = {8, 9, 10, 11};
int tones[4] = {262, 330, 392, 523};
int buzzer = 12;
int sequence[30];
int level = 0;
void playStep(int index)
{
digitalWrite(ledPins[index], HIGH);
tone(buzzer, tones[index], 300);
delay(400);
digitalWrite(ledPins[index], LOW);
delay(120);
}
int waitForPress()
{
while (true)
{
for (int i = 0; i < 4; i++)
{
if (digitalRead(buttonPins[i]) == LOW)
{
playStep(i);
while (digitalRead(buttonPins[i]) == LOW)
{
delay(10);
}
return i;
}
}
delay(10);
}
}
void gameOver()
{
Serial.print("Game over at level ");
Serial.println(level);
for (int i = 0; i < 3; i++)
{
tone(buzzer, 120, 250);
for (int j = 0; j < 4; j++)
{
digitalWrite(ledPins[j], HIGH);
}
delay(250);
for (int j = 0; j < 4; j++)
{
digitalWrite(ledPins[j], LOW);
}
delay(250);
}
level = 0;
delay(1500);
}
void setup()
{
for (int i = 0; i < 4; i++)
{
pinMode(ledPins[i], OUTPUT);
pinMode(buttonPins[i], INPUT_PULLUP);
}
pinMode(buzzer, OUTPUT);
randomSeed(analogRead(A0));
Serial.begin(9600);
Serial.println("Watch the pattern, then repeat it");
}
void loop()
{
sequence[level] = random(0, 4);
level = level + 1;
Serial.print("Level ");
Serial.println(level);
delay(700);
for (int i = 0; i < level; i++)
{
playStep(sequence[i]);
}
for (int i = 0; i < level; i++)
{
int pressed = waitForPress();
if (pressed != sequence[i])
{
gameOver();
return;
}
}
tone(buzzer, 700, 150);
delay(600);
}
Use the kit's mini-USB cable, install the CH340 driver on Windows if no port appears, pick Tools > Board > Arduino Nano and try Tools > Processor > ATmega328P (Old Bootloader) if the upload times out.
Turn it round: the long leg (anode) goes to the pin side through the 220 ohm resistor, the short leg to GND.
The sketch uses INPUT_PULLUP, so one leg goes to the pin and the other to GND. Use two legs on opposite sides of the button.
This project needs the passive buzzer (the one that plays notes with tone()), not the active one.
The whole game lives in one array of up to thirty steps and a variable saying how many of them are in play. Each round appends one new random step and replays the lot, then waits for that many button presses. Giving every colour its own tone means players remember the melody as well as the lights, which is why the original game was so hard to put down.
One LED flashes with a tone, press the matching button. Each round adds one more step to remember. A wrong press flashes all four LEDs with a low buzz and restarts.
Yes. It is project 50 of 61 in the Geekobot Explorer Kit, in level 9 (Interactive games). Every part on the list comes in the kit box, and you can also buy the parts one by one from the list above.
No. Every Explorer Kit project is wired on the Nano I/O shield and the breadboard with jumper wires.
9 parts: Generic Nano CH340 Development Board (Soldered), USB Cable, Solderless Breadboard, Dupont Jumper Wires (40 pcs), Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), 4 × Tactile Push Button Switch, Buzzer Module 3.3–5V and Arduino Nano IO Expansion Shield (328P Compatible). On this page you can tick the parts you already have and add only the rest to your cart.
It is a intermediate project and takes about 1 hour. The build on this page has 6 steps.
No. This page has the complete, tested code (explorer_kit_50_memory_sequence_game.ino).
About ₹508 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Arrays, timing and game loops; Growing a sequence one element per round; Blocking input functions that wait for a press; Giving audio and visual feedback together.
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Press to roll: the pips tumble and slow down before landing on a number.
Wait for the light, hit the button: how many milliseconds can you beat?
A bright 4-digit clock that keeps time through power cuts.
Learning project. Check every circuit and the datasheet of each part before you power it up.