const int button1 = 31;
const int button2 = 32;
const int led1 = 13;
const int button3 = 33;
const int button4 = 34;
const int led2 = 12;
const int button5 = 35;
const int button6 = 36;
const int led3 = 11;
const int button7 = 37;
const int button8 = 38;
const int led4 = 10;
const int button9 = 39;
const int button10 = 40;
const int led5 = 9;
const int buzzer = 8; // Added buzzer pin
void setup() {
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(led1, OUTPUT);
pinMode(button3, INPUT_PULLUP);
pinMode(button4, INPUT_PULLUP);
pinMode(led2, OUTPUT);
pinMode(button5, INPUT_PULLUP);
pinMode(button6, INPUT_PULLUP);
pinMode(led3, OUTPUT);
pinMode(button7, INPUT_PULLUP);
pinMode(button8, INPUT_PULLUP);
pinMode(led4, OUTPUT);
pinMode(button9, INPUT_PULLUP);
pinMode(button10, INPUT_PULLUP);
pinMode(led5, OUTPUT);
pinMode(buzzer, OUTPUT); // Added buzzer pin
}
void loop() {
// Check for simultaneous button press for LED1
if (digitalRead(button1) == LOW && digitalRead(button2) == LOW) {
digitalWrite(led1, HIGH);
} else {
digitalWrite(led1, LOW);
}
// Check for simultaneous button press for LED2
if (digitalRead(button3) == LOW && digitalRead(button4) == LOW) {
digitalWrite(led2, HIGH);
} else {
digitalWrite(led2, LOW);
}
// Check for simultaneous button press for LED3
if (digitalRead(button5) == LOW && digitalRead(button6) == LOW) {
digitalWrite(led3, HIGH);
} else {
digitalWrite(led3, LOW);
}
// Check for simultaneous button press for LED4
if (digitalRead(button7) == LOW && digitalRead(button8) == LOW) {
digitalWrite(led4, HIGH);
} else {
digitalWrite(led4, LOW);
}
// Check for simultaneous button press for LED5
if (digitalRead(button9) == LOW && digitalRead(button10) == LOW) {
digitalWrite(led5, HIGH);
} else {
digitalWrite(led5, LOW);
}
// Check for simultaneous press of all buttons and sound the buzzer
if (digitalRead(button1) == LOW && digitalRead(button2) == LOW &&
digitalRead(button3) == LOW && digitalRead(button4) == LOW &&
digitalRead(button5) == LOW && digitalRead(button6) == LOW &&
digitalRead(button7) == LOW && digitalRead(button8) == LOW &&
digitalRead(button9) == LOW && digitalRead(button10) == LOW) {
tone(buzzer, 1000); // You can adjust the frequency as needed
} else {
noTone(buzzer);
}
}