```cpp
#include <LiquidCrystal.h>
// Pin configuration for the MQ-2 smoke sensor
const int mq2Pin = A0; // Analog pin for MQ-2 sensor
// Pin configuration for the Flame sensor
const int flamePin = 2; // Digital pin for Flame sensor
// Pin configuration for the LCD
LiquidCrystal lcd(8, 9, 4, 5, 6, 7); // RS, EN, D4, D5, D6, D7
// Pin for the speaker or piezo element
const int speakerPin = 10; // Connect the speaker or piezo to digital pin 10
// Threshold values
const int smokeThreshold = 300;
const int flameThreshold = LOW;
void setup() {
// Initialize the LCD
lcd.begin(16, 2);
// Initialize the MQ-2 sensor pin
pinMode(mq2Pin, INPUT);
// Initialize the Flame sensor pin
pinMode(flamePin, INPUT);
// Set up the speaker pin
pinMode(speakerPin, OUTPUT);
// Set up the initial display message
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Fire Detection" , );
}
void loop() {
// Read the value from the MQ-2 smoke sensor
int smokeValue = analogRead(mq2Pin);
// Read the value from the Flame sensor
int flameValue = digitalRead(flamePin);
// Check if the smoke or flame sensor readings are above the threshold
if (smokeValue > smokeThreshold || flameValue == flameThreshold) {
// Clear the LCD and print the "Fire detected" message
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Fire detected");
// Generate a tone to create a sound
tone(speakerPin, 1000); // You can adjust the frequency as needed
// You can add additional actions here, like sending a notification.
} else {
// Clear the LCD and display a standby message
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Standby");
// Turn off the tone
noTone(speakerPin);
}
// Delay for a moment to avoid rapid display updates
delay(1000);
}
```