--> Project V - 3. The Quiz Button with 4 of Group (Arduino Based) | basic arduino tutorial

Thursday, August 10, 2017

Project V - 3. The Quiz Button with 4 of Group (Arduino Based)

| Thursday, August 10, 2017
The Quiz Button with 4 of Group



As it is used in quizzes event, when one of the buttons is pressed first the other button when pressed does not sound. The buttons used is 4 push button . Bell (Speaker) and lights used as a marker which button is pressed first. Relay as driver light and bell. Arduino UNO as its processor.

Hardware Requirement
  • Relay Module 5V with 4 Channel
  • Arduino UNO
  • Push Button
  • A Buzzer
  • Power supply +5 Volt
  • Jumper



Push Button | Source                        Buzzer | Source


Relay Module with 4 Channel | Source


Block Diagram



Schematic



Arduino - Button Wiring


Arduino - Relay Wiring


Arduino - Buzzer Wiring



Source Code/Sketch

const int tombolA = 2;
const int tombolB = 3;
const int tombolC = 4;
const int tombolD = 5;
const int lampuA = 8;
const int lampuB = 9;
const int lampuC = 10;
const int lampuD = 11;
const int bel = 12;
void setup(){
for(char i=2; i<6; i++){
pinMode(i, INPUT);
digitalWrite(i,HIGH);
}
for(char i=8; i<13; i++){
pinMode(i, OUTPUT);
digitalWrite(i,LOW);
}
}
void loop(){
if(digitalRead(tombolA)==LOW){
digitalWrite(bel,HIGH);
digitalWrite(lampuA,HIGH);
delay(500);
while(!digitalRead(tombolA));
digitalWrite(bel,LOW);
digitalWrite(lampuA,LOW);
}
else if(digitalRead(tombolB)==LOW){
digitalWrite(bel,HIGH);
digitalWrite(lampuB,HIGH);
delay(500);
while(!digitalRead(tombolB));
digitalWrite(bel,LOW);
digitalWrite(lampuB,LOW);
}
else if(digitalRead(tombolC)==LOW){
digitalWrite(bel,HIGH);
digitalWrite(lampuC,HIGH);
delay(500);
while(!digitalRead(tombolC));
digitalWrite(bel,LOW);
digitalWrite(lampuC,LOW);
}
else if(digitalRead(tombolD)==LOW){
digitalWrite(bel,HIGH);
digitalWrite(lampuD,HIGH);
delay(500);
while(!digitalRead(tombolD));
digitalWrite(bel,LOW);
digitalWrite(lampuD,LOW);
}
}


How it Works

Suppose button 1 is pressed then bell beeps and light 1 lights up, while other lights off. If button 1 is not pressed then light 1 and bell turn off. So also for the other buttons.



Video for Project V - 3. The Quiz Button with 4 of Group (Arduino Based)






Required File


Related Posts

No comments:

Post a Comment