Built-in project · Arduino Uno R3

Quiz buzzer for three players on an Arduino Uno

Three answer buttons on pins 2, 3 and 4 and a reset button on 9: the first to press lights their LED (pins 6, 7 and 8) and sounds the buzzer on pin 5; the LED on pin 10 shows the round is open. The whole build, an Arduino Uno and 13 more parts, runs here in your browser on the firmware below; open it in the editor to change the wiring or the code and run it again.

Teaching? Assign it to your class in one click.

Intermediate Runs in your browser. Free, and no account needed.

Quiz buzzer for three players · Arduino Uno R3live0.000 s 0.00x
Press one of the three left buttons
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

The code

The firmware exactly as the editor opens it. Change a line there and press Run: it compiles in the browser.

sketch.ino · Arduino Uno R3
// A quiz buzzer: whoever presses first gets the light and the beep.
//
//   answer buttons -> pins 2, 3, 4, reset button -> pin 9 (each to GND,
//                     read with INPUT_PULLUP)
//   player LEDs    -> pins 6, 7, 8, through 220 ohm each
//   ready LED      -> pin 10, through 220 ohm
//   buzzer         -> pin 5
//
// While the round is open, the ready LED is lit and the sketch watches all
// three answer buttons. The first one pressed wins: its LED lights, the
// buzzer beeps, and the others are ignored until reset is pressed.

const int ANSWER[3] = {2, 3, 4};
const int PLAYER_LED[3] = {6, 7, 8};
const int RESET = 9;
const int READY_LED = 10;
const int BUZZER = 5;

bool open = true;

void startRound() {
  open = true;
  for (int i = 0; i < 3; i++) digitalWrite(PLAYER_LED[i], LOW);
  digitalWrite(READY_LED, HIGH);
  Serial.println("ready: first to press wins");
}

void setup() {
  for (int i = 0; i < 3; i++) {
    pinMode(ANSWER[i], INPUT_PULLUP);
    pinMode(PLAYER_LED[i], OUTPUT);
  }
  pinMode(RESET, INPUT_PULLUP);
  pinMode(READY_LED, OUTPUT);
  pinMode(BUZZER, OUTPUT);
  Serial.begin(9600);
  Serial.println("Mokxi Uno: quiz buzzer");
  startRound();
}

void loop() {
  if (open) {
    for (int i = 0; i < 3; i++) {
      if (digitalRead(ANSWER[i]) == LOW) {
        open = false;
        digitalWrite(READY_LED, LOW);
        digitalWrite(PLAYER_LED[i], HIGH);
        Serial.print("player ");
        Serial.print(i + 1);
        Serial.println(" was first");
        digitalWrite(BUZZER, HIGH);
        delay(300);
        digitalWrite(BUZZER, LOW);
        break;
      }
    }
  } else if (digitalRead(RESET) == LOW) {
    startRound();
    delay(200);
  }
}

Parts list

15 parts, plus the jumper wires. Every one is in the editor's parts bin.

How it is wired

14 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • Arduino Uno R3 pin 10; Resistor, 220 Ω (4) pin 1
  • Arduino Uno R3 pin 9; Pushbutton (4) pin 1a
  • Arduino Uno R3 pin 8; Resistor, 220 Ω (3) pin 1
  • Arduino Uno R3 pin 7; Resistor, 220 Ω (2) pin 1
  • Arduino Uno R3 pin 6; Resistor, 220 Ω (1) pin 1
  • Arduino Uno R3 pin 5; Buzzer pin 1
  • Arduino Uno R3 pin 4; Pushbutton (3) pin 1a
  • Arduino Uno R3 pin 3; Pushbutton (2) pin 1a
  • Arduino Uno R3 pin 2; Pushbutton (1) pin 1a
  • Ground: Arduino Uno R3 pin GND; Pushbutton (1) pin 2a; Pushbutton (2) pin 2a; Pushbutton (3) pin 2a; Pushbutton (4) pin 2a; LED, red pin C; LED, yellow pin C; LED, green pin C; LED, blue pin C; Buzzer pin 2
  • Resistor, 220 Ω (1) pin 2; LED, red pin A
  • Resistor, 220 Ω (2) pin 2; LED, yellow pin A
  • Resistor, 220 Ω (3) pin 2; LED, green pin A
  • Resistor, 220 Ω (4) pin 2; LED, blue pin A

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.