int x=1;
int y=0;
int buz=15;
void low()
{
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
}
void chk()
{
if(digitalRead(9)&& x)
{
digitalWrite(3,HIGH);
x=0;
y=1;
Serial.print(x);
Serial.print("3");
}
else if(digitalRead(10)&& x)
{
digitalWrite(4,HIGH);
x=0;
y=1;
Serial.println("4");
Serial.print(x);
}
else if(digitalRead(11)&& x)
{
digitalWrite(5,HIGH);
y=1;
x=0;
Serial.println("5");
}
else if(digitalRead(12)&& x)
{
digitalWrite(6,HIGH);
x=0;
y=1;
Serial.println("6");
}
else if(digitalRead(13)&& x)
{
digitalWrite(7,HIGH);
x=0;
y=1;
Serial.println("7");
}
else if(digitalRead(14)&& x)
{
digitalWrite(8,HIGH);
x=0;
y=1;
Serial.println("8");
}
}
////////////////////////////////////////////////////////////////////////////////////////////
void setup()
{
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
Serial.begin(9600);
Serial.println("Started");
/////////////////////////////////////////////////////////////////////////////////
pinMode(9,INPUT);
pinMode(10,INPUT);
pinMode(11,INPUT);
pinMode(12,INPUT);
pinMode(13,INPUT);
pinMode(14,INPUT);
////////////////////////
low();
}
void loop()
{
while(1)
{
chk();
if(y)
{
digitalWrite(buz,HIGH);
Serial.println("buzon");
delay(3500);
digitalWrite(buz,LOW);
delay(5000);
break;
}
}
x=1;
y=0;
low();
}
Monday, November 26, 2012
Arduino-Quiz- Buzzer Sytem
A quiz Buzzer System Based on Arduino-Atmega8
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment