const int buzzerPin = 5;
const int flamePin = 2;
int Flame = HIGH;
void setup()
{
pinMode(buzzerPin, OUTPUT);
pinMode(flamePin, INPUT);
Serial.begin(9600);
}
void loop()
{
Flame = digitalRead(flamePin);
if (Flame == LOW)
{
Serial.println("Fire is Detected");
digitalWrite(buzzerPin, HIGH);
delay(1000); // Adjust the duration of the buzzer sound as needed
digitalWrite(buzzerPin, LOW);
delay(1000); // Add a delay before rechecking the flame status
}
else
{
Serial.println("No Fire is Detected");
digitalWrite(buzzerPin, LOW);
delay(500); // Add a delay before rechecking the flame status
}
}