Remote-controlled RGB mood light
Warm, cool, rainbow or breathing: cycle lighting moods from your sofa.
Shop by category
Shop all componentsThe 1602 LCD keypad shield puts a 16x2 character LCD and five buttons on top of an Uno. The five buttons share one analog pin (A0) through a resistor ladder: each button gives a different voltage, so the sketch reads A0 to tell them apart. This game waits a random time, shows GO and measures how fast you press. Pressing too early counts as a false start.
Tick anything you already have and the total updates.
Follow the colours: red is power, dark grey is ground, blue is a signal.
USB or a 9 V adapter on the Uno.
reaction.inoVerify & upload in Electrolark#include <LiquidCrystal.h>
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
unsigned long best = 99999;
int readKey() { // 0 none, 1 right, 2 up, 3 down, 4 left, 5 select
int v = analogRead(A0);
if (v < 60) return 1; if (v < 200) return 2; if (v < 400) return 3; if (v < 600) return 4; if (v < 800) return 5;
return 0;
}
void waitRelease() { while (readKey() != 0) delay(5); }
void setup() {
lcd.begin(16, 2);
randomSeed(analogRead(A1));
lcd.print("Reaction game");
lcd.setCursor(0, 1); lcd.print("SELECT to start");
}
void loop() {
if (readKey() != 5) return;
waitRelease();
lcd.clear(); lcd.print("Wait for GO...");
unsigned long until = millis() + random(1500, 5000);
while (millis() < until) {
if (readKey() == 5) { lcd.clear(); lcd.print("Too early!"); waitRelease(); delay(1500); lcd.clear(); lcd.print("SELECT to retry"); return; }
}
lcd.clear(); lcd.print("GO!");
unsigned long t0 = millis();
while (readKey() != 5);
unsigned long ms = millis() - t0;
if (ms < best) best = ms;
lcd.clear(); lcd.print("Time: "); lcd.print(ms); lcd.print(" ms");
lcd.setCursor(0, 1); lcd.print("Best: "); lcd.print(best); lcd.print(" ms");
waitRelease();
}
Turn the contrast trimmer slowly until characters appear.
Ladder values vary between shields; print A0 and set the limits from your readings.
Backlight is on D10 on most shields; do not set D10 LOW.
Most people press between 200 and 300 ms.
Yes, give one player LEFT and the other RIGHT and see who presses first.
Yes, store it in EEPROM so it stays after power off.
2 parts: Uno R3 CH340G ATmega328p Compatible Development Board and Arduino 1602 LCD Keypad Shield – Blue Backlight. On this page you can tick the parts you already have and add only the rest to your cart.
It is a beginner project and takes about 1 hour. The build on this page has 4 steps.
No. This page has the complete, tested code (reaction.ino).
About ₹380 for the parts at the prices on this page. Quantity price breaks lower the cost when you build several.
Driving a character LCD with LiquidCrystal; Reading several buttons on one analog pin; Measuring time with millis().
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.