Mohamed Chaara
Published © GPL3+

2 Players Competition/Quiz Buzzer Box System Using Arduino

A quiz buzzer box system using Arduino.

BeginnerFull instructions provided5 hours2,112
2 Players Competition/Quiz Buzzer Box System Using Arduino

Things used in this project

Hardware components

Microchip Technology ATMega328P-PU
×1
16 MHz Crystal
16 MHz Crystal
×1
Capacitor 22 pF
Capacitor 22 pF
×2
LED (generic)
LED (generic)
5mm * 10 3 mm * 2
×12

Software apps and online services

Arduino IDE
Arduino IDE
Solid Works

Hand tools and fabrication machines

Laser cutter (generic)
Laser cutter (generic)
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Custom parts and enclosures

Box

Box drawing

Code

CompetitionBox

Arduino
Upload this to your arduino using the IDE
/*
  Competition box

  The idea is when two contistants wish to answer, the moment one of them pushes a button, the second contester input will not be taken into account, and the LED of the faster competitor will light.

  The whole setup will reset after a delay of 10000.
  Created by Mohamed Chaara - 29 Mar 2017

*/

int FirstLED      =   8;
int SecondLED     =   9;
int greenLED      =   10;
int redLED        =   11;
int FirstButton   =   12;
int SecondButton  =   13;


void setup() {
  // put your setup code here, to run once:

  pinMode(FirstLED, OUTPUT);
  pinMode(SecondLED, OUTPUT);
  pinMode(greenLED, OUTPUT);
  pinMode(redLED, OUTPUT);

  pinMode(FirstButton, INPUT_PULLUP);
  pinMode(SecondButton, INPUT_PULLUP);

}

void loop() {
  // put your main code here, to run repeatedly:

  //First action: Reset everything and activate green LED

  digitalWrite(redLED, LOW);
  digitalWrite(greenLED, HIGH);

  digitalWrite(FirstButton, LOW);
  digitalWrite(SecondButton, LOW);
  digitalWrite(FirstLED, LOW);
  digitalWrite(SecondLED, LOW);

  static boolean pushed = false;

  //conditions go here:

  
  if (digitalRead(FirstButton) == HIGH && pushed == false) {

    //first button is pushed and the game status is open for contestans:

    //Swich on the LED for the first player:
    
    pushed = true;
    digitalWrite(FirstLED, HIGH);
    digitalWrite(greenLED, LOW);
    digitalWrite(redLED, HIGH);
    
    //Wait for game to open again:
    delay(10000);

  }

  if (digitalRead(SecondButton)== HIGH && pushed == false) {

    //second button is pushed and the game status is open for contestans:

    //Change game status to closed:
    pushed = true;

    //Swich on the LED for the second player:
    digitalWrite(SecondLED, HIGH);
    digitalWrite(greenLED, LOW);
    digitalWrite(redLED, HIGH);

    //Wait for game to open again:
    delay(10000);
  }

  pushed  = false;
}

Credits

Mohamed Chaara

Mohamed Chaara

0 projects • 1 follower

Comments