Arduino project · firmware v2

Busfahren♥♦♣♠

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.

HD44780 · 16×2
Live demo
Pot 512 · — Phase 1 / 4
Pot · Select
Button · Confirm
Buzzer · Reset

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.

01

How the game works

4 questions + bus

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.

Question 1

Red or black?

The question is the colour of the first card. Pot left = red, right = black.

Question 2

Higher or lower?

Is the next card above or below the one shown? A tie does not count.

Question 3

Between or outside?

Does the third card fall within the range of the first two – or outside it?

Question 4

Which suit?

Hearts, diamonds, clubs or spades? Four pot ranges, one suit.

Finale

Busfahren

Five times higher/lower in a row. One mistake – and the ride starts again from the beginning.

02

Build your own

Parts & wiring

Components

Arduino Uno (or Nano)Core, 5 V logic1×
LCD 16×2, HD44780Standard character display1×
Pot 10 kΩGame selection → A01×
Pot 10 kΩLCD contrast (V0)1×
Push buttonConfirm → A11×
Piezo buzzer, passiveTones → D13 (for tone())1×
Resistor 220 ΩLCD backlight (pin A)1×
OLED SSD1306 128×32Scrolling text, optional → I²C0–1×
Breadboard + jumper wiresWiring—
The buzzer must be passive – an active buzzer only hums at a single fixed frequency and ignores the melody.

Wiring

ComponentPinArduino
LCD RS4D7
LCD E6D6
LCD D411D5
LCD D512D4
LCD D613D3
LCD D714D2
LCD RW5GND
LCD V03Pot wiper
LCD VSS / K1 / 16GND
LCD VDD25V
LCD A155V · 220Ω
Game potWiperA0
Button—A1 → GND
Buzzer +—D13
OLED SDA / SCL—A4 / A5
The button uses INPUT_PULLUP: one leg to A1, the other to GND. No external resistor needed.
ARDUINO UNO D2–D7 · A0 · A1 · D13 · A4/A5 5V · GND Busfahren v2.ino LCD 16×2 HD44780 · 4-bit D2–D7 Pot · A0 Button A1 → GND Buzzer D13 OLED (optional) I²C · A4/A5
03

What makes v2 more stable

Firmware diff

The game logic has stayed the same – just more robust. The most important changes compared with the first version:

01
No more recursion in the bus. The restart after a mistake was a self-call – after many failed attempts a stack overflow was looming. Now it is a loop.
02
Fair phase 1. The cards were sorted at the start, so “Higher” was always right. Sorting removed; phase 3 compares via min/max.
03
Boundary bug fixed. The &&/|| condition in “Between/Outside” was bracketed incorrectly and always made edge cases “correct”. Rewritten.
04
One button handler. Short and long presses shared raw digitalRead and got in each other's way. Now debounced: short press on release, long press fires once.
05
Real randomness. Without randomSeed the same card sequence came up after every power-on. Now seeded from an open analogue pin + micros().
06
Loop runs smoothly. The OLED scrolling text blocked with delay(50). Now non-blocking, and via USE_OLED it can be switched off completely.
⇩ Request firmware v2 ⇩ Download this page Everything offline · no external requests

Contact

Questions about the construction, the decisions behind it or how it could carry over to another case.

Arithmetic check Arithmetic task, shown as an image

No Google captcha, no cookies, nothing passed to third parties. Prefer e-mail? info@timobritz.de.