// Wire Buzzer Game with LED Indicator
const int wirePin = A0; // Analog pin connected to wire loop
const int buzzerPin = 8; // Digital pin connected to buzzer
const int ledPin = 13; // Digital pin connected to LED indicator
void setup() {
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
pinMode(wirePin, INPUT);
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(wirePin);
// If the sensor detects a touch, trigger the buzzer and turn on the LED
if (sensorValue > 800) {
digitalWrite(buzzerPin, HIGH);
digitalWrite(ledPin, HIGH);
delay(1000); // Buzzer and LED on for 1 second
digitalWrite(buzzerPin, LOW);
digitalWrite(ledPin, LOW);
}
delay(100); // Adjust delay as needed for responsiveness
}