Quiz Button Competition

6 button Player Button & 6 Led
1 butron Reset
1 button button qorrect & led
1 button button wrong & led

First turned on, plays the mp3 file play as an intro and can be skipped by pressing the reset button.
The group that presses the button first will lock the other group's button accompanied by the group's led that lights up and plays the mp3 file according to the first one pressed, after the first group presses the button gives the answer, then the true button and the wrong button will evaluate the answer accompanied by the right led light. or wrong.
To reset the locked button and led group or answer button, by pressing the reset button.

can anyone make a complete arduino program??

I'm sure that people can. But in general the users here don't write code for you but try to teach you how to approach it and solve the problems that you encounter.

Anything wrong with the reply in Competition Button?

1 Like

Did you actually read what you wrote ?

Does it make sense to you ?

#include "DFRobotDFPlayerMini.h"
#include "SoftwareSerial.h"

// Use pins 2 and 3 to communicate with DFPlayer Mini
static const uint8_t PIN_MP3_TX = 2; // connect to pin 2 on the DFPlayer via a 1K resistor
static const uint8_t PIN_MP3_RX = 3; // connect to pin 3 on the DFPlayer

// Software serial library
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
// Player
DFRobotDFPlayerMini player;

// Pins for buttons
const unsigned char switches[4] = {A0, A1, A2, A3};

// Pins for LEDs
const unsigned char leds[4] = {9, 10, 11, 12};

// Reset button
const unsigned char switch_reset = 6;

// Prepare the Arduino
void setup() {
// Prepare the pins

pinMode(switch_reset, INPUT_PULLUP);
for (unsigned char sw=0; sw<4; sw++) {
pinMode(switches[sw], INPUT_PULLUP);
pinMode(leds[sw], OUTPUT);
digitalWrite(leds[sw], LOW);
}

// Init serial port for DFPlayer Mini
softwareSerial.begin(9600);
// Start communication with DFPlayer Mini
if (player.begin(softwareSerial)) player.volume(30);
player.play(11);
}

// Main loop
void loop() {
// Check all 4 switches
for (unsigned char sw=0; sw<4; sw++) {
// Is it pressed?
if (digitalRead(switches[sw]) == LOW) {
// Turn on its LED
digitalWrite(leds[sw], HIGH);
// Play its sfx
player.play(sw+1);
// Wait for the reset button
while (digitalRead(switch_reset) == HIGH) {};
// Stop any playing sfx
player.stop();
// Turn off the LED
digitalWrite(leds[sw], LOW);
// Stop!
break;
}
}
}

But there is no right and wrong answer button yet.

this might help:

Arduino: Buzzer-Buttons für 4 Spieler - Finite State Machine (rothschopf.net)

you can translate the page with an online tool.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.