SIMPLE RESPONDER

In the knowledge contest and recreational activities, to accurately and visually judge the responding person's seat number, the organizer generally uses a responder generally to greatly increase the entertainment and make the activities fairer. Today, we make a four-circuit signal responder with LED, buzzer and button.

Components
DFRduino UNO R3 (Similar as Arduino UNO)
IO Expansion Shield for Arduino V7.1
Digital Push Button *4
Digital White LED Light Module
Digital Buzzer For Arduino
Box

[Making Procedure]

  1. As shown in the figure below, find a box as the responder.
  2. Prepare the product design drawing. There was no buzzer on the draft. I added it on that night.
  3. To mount the LED at the appropriate position of the panel, I decide to draw lines on it and then drill holes.


    Drill the approximate position and mark the hole position. Then, drill holes. The hole position is large, so slight rotation cannot meet the demand.


  4. Install the components (LED, button and main control panel) on it.

[Connection]
The digital ports: 4, 5, 6, 7 of LED are located from left to right successively.
The digital ports: 8, 9, 10, 11 of button are located from left to right successively.

Buzzer digital port: 3
Code

int yellowLed = 4;       
int blueLed = 5;  
int redLed = 6;   
int whiteLed = 7;  
int yellowPin =8;            
int bluePin =9;             
int redPin =10;             
int whitePin =11;             


void setup() {
  pinMode(yellowLed, OUTPUT);     
  pinMode(blueLed, OUTPUT);     
  pinMode(redLed, OUTPUT);    
  pinMode(whiteLed, OUTPUT);     
  pinMode(yellowPin, INPUT);    
  pinMode(bluePin, INPUT);    
  pinMode(redPin, INPUT);    
  pinMode(whitePin, INPUT);    
}


void buzzer() 
{      
int i;
  for(i=0;i<180;i++)      
     {
       digitalWrite(3,HIGH);
        delay(1);// delay 1ms
       digitalWrite(3,LOW);
        delay(1);//delay ms
        }
} 


void loop()
{
  int val1 = digitalRead(yellowPin);  
  int val2 = digitalRead(bluePin); 
  int val3 = digitalRead(redPin);  
  int val4 = digitalRead(whitePin);  
//int val5 = digitalRead(inputPin);  
if(val1==LOW&&val2==LOW&&val3==LOW&&val4==LOW)
    {
        return;
     } 

   if (val1 == HIGH&&val2==LOW&&val3==LOW&&val4==LOW) {          
   buzzer();
   digitalWrite(yellowLed, HIGH);  
    digitalWrite(blueLed, LOW);  
    digitalWrite(redLed, LOW);  
    digitalWrite(whiteLed, LOW);  
  } 
else{
    if (val2 == HIGH&&val1 == LOW&&val3==LOW&&val4==LOW) {           
   buzzer();
    digitalWrite(yellowLed, LOW); 
    digitalWrite(blueLed, HIGH); 
    digitalWrite(redLed, LOW);  
    digitalWrite(whiteLed, LOW);  
}

  else{
     if (val3 == HIGH&&val1 == LOW&&val2==LOW&&val4==LOW) {        
   buzzer();
    digitalWrite(yellowLed, LOW); 
    digitalWrite(blueLed, LOW);  
    digitalWrite(redLed, HIGH);  
    digitalWrite(whiteLed, LOW);  
  }

  else{
     if (val4 == HIGH&&val1==LOW&&val2==LOW&&val3==LOW) {    
   buzzer();
    digitalWrite(yellowLed, LOW); 
    digitalWrite(blueLed, LOW); 
    digitalWrite(redLed, LOW);  
    digitalWrite(whiteLed, HIGH); 
}


else{
     return;
}
}
}
  }

}

[Summary]
In fact, this product is not complicated. You may renovate it if you are interested. For example, LCD screen can be added on the responder to allow the host to easily see the responding result, rather than seeing it in front of the responder by overstretching his/her neck.