The pub card game as a handheld. Four questions, then the bus ride – all on a 16×2 character LCD, controlled with a potentiometer and a push button. Below, the real game logic runs in the browser.
Turning the pot selects, OK confirms. A long press (the ring fills up) jumps straight to the bus ride. Keyboard: ← → for the pot, Enter for the button.
Each correct answer moves on by one question. A mistake means drinking (as many sips as the question number) and going back to the start. Anyone who gets through all four still has to ride the bus.
The question is the colour of the first card. Pot left = red, right = black.
Is the next card above or below the one shown? A tie does not count.
Does the third card fall within the range of the first two – or outside it?
Hearts, diamonds, clubs or spades? Four pot ranges, one suit.
Five times higher/lower in a row. One mistake – and the ride starts again from the beginning.
| Arduino Uno (or Nano) | Core, 5 V logic | 1× |
| LCD 16×2, HD44780 | Standard character display | 1× |
| Pot 10 kΩ | Game selection → A0 | 1× |
| Pot 10 kΩ | LCD contrast (V0) | 1× |
| Push button | Confirm → A1 | 1× |
| Piezo buzzer, passive | Tones → D13 (for tone()) | 1× |
| Resistor 220 Ω | LCD backlight (pin A) | 1× |
| OLED SSD1306 128×32 | Scrolling text, optional → I²C | 0–1× |
| Breadboard + jumper wires | Wiring | — |
| Component | Pin | Arduino |
|---|---|---|
| LCD RS | 4 | D7 |
| LCD E | 6 | D6 |
| LCD D4 | 11 | D5 |
| LCD D5 | 12 | D4 |
| LCD D6 | 13 | D3 |
| LCD D7 | 14 | D2 |
| LCD RW | 5 | GND |
| LCD V0 | 3 | Pot wiper |
| LCD VSS / K | 1 / 16 | GND |
| LCD VDD | 2 | 5V |
| LCD A | 15 | 5V · 220Ω |
| Game pot | Wiper | A0 |
| Button | — | A1 → GND |
| Buzzer + | — | D13 |
| OLED SDA / SCL | — | A4 / A5 |
INPUT_PULLUP: one leg to A1, the other to GND. No external resistor needed.The game logic has stayed the same – just more robust. The most important changes compared with the first version:
digitalRead and got in each other's way. Now debounced: short press on release, long press fires once.randomSeed the same card sequence came up after every power-on. Now seeded from an open analogue pin + micros().delay(50). Now non-blocking, and via USE_OLED it can be switched off completely.Questions about the construction, the decisions behind it or how it could carry over to another case.