Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsThe Arduino waits a random 2 to 5 seconds so you cannot guess, lights the LED and starts a millis() timer. When you press the button the timer stops, the buzzer beeps and your time prints in the Serial Monitor. Press too early and it calls a false start. Under 200 ms is superhuman; 200 to 300 ms is excellent.
Every part for this build comes in the Geekobot Spark Kit box, a Geekobot exclusive, together with the parts for all 24 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 Spark Kit project
330 ohm resistor pack: limits the LED current
Sensor Shield v5.0 from the kit: every pin has its own G, V, S header, so modules plug in with female jumpers
Follow the colours: red is power, dark grey is ground, blue is a signal.
spark_kit_24_reaction_time_game.inoVerify & upload in Electrolark// Spark Kit 24: reaction time game
int led = 2;
int button = 3; // to GND, internal pull-up
int buzzer = 8;
void setup() {
pinMode(led, OUTPUT);
pinMode(buzzer, OUTPUT);
pinMode(button, INPUT_PULLUP);
Serial.begin(9600);
randomSeed(analogRead(A0)); // unconnected pin gives a random seed
Serial.println("Get ready...");
}
void loop() {
digitalWrite(led, LOW);
unsigned long wait = random(2000, 5000);
unsigned long t0 = millis();
while (millis() - t0 < wait) {
if (digitalRead(button) == LOW) { // pressed too early
Serial.println("False start! Wait for the LED.");
delay(1000);
return;
}
}
digitalWrite(led, HIGH);
unsigned long startTime = millis();
while (digitalRead(button) == HIGH) {} // wait for the press
unsigned long reactionTime = millis() - startTime;
digitalWrite(buzzer, HIGH);
delay(150);
digitalWrite(buzzer, LOW);
Serial.print("Reaction Time: ");
Serial.print(reactionTime);
Serial.println(" ms");
delay(2000);
}
Use the kit's USB cable (some phone cables carry power only), install the CH340 driver on Windows if the port does not appear, and pick Tools > Board > Arduino Uno.
The button is wired to 5V instead of GND, or it sits the wrong way across the gap so it is always closed.
Same cause: the button reads pressed all the time. Rotate it 90 degrees.
Under 200 ms superhuman, 200-300 ms excellent, 300-400 ms good, 400-500 ms average, over 500 ms keep practising.
Yes: add the display from project 22 on D4 / D5 and call showNumberDec(reactionTime).
Yes. It is one of the 24 projects in the Geekobot Spark Kit, and every part on the list comes in the kit box. You can also buy the parts one by one from the list above.
No. Every Spark Kit project is wired on the breadboard or the Sensor Shield with jumper wires.
9 parts: Uno R3 CH340G ATmega328p Compatible Development Board, Arduino USB-A to USB-B Data Cable for UNO/MEGA, Through-Hole LED Pack (Pack of 10), Carbon Film Resistor 1/4W 5% (Pack of 10), Tactile Push Button Switch, PCB Mounted Active Buzzer Module, Solderless Breadboard, Dupont Jumper Wires (40 pcs) and Arduino Sensor Shield V5 Expansion Board. 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 45 minutes. The build on this page has 7 steps.
No. This page has the complete, tested code (spark_kit_24_reaction_time_game.ino).
About ₹472 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
millis() timing; Random numbers with random(); Reading inputs in real time; Putting a whole game 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.
Lessons are free to read. Maker (₹499/month) and Pro add quizzes, worked problems and certificates, paid with your Geekobot account. See plans
Learning project. Check every circuit and the datasheet of each part before you power it up.