// include the library code:
#include <LiquidCrystal.h>
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
const int buzzer = 9; //buzzer to arduino pin 9
const int TMP36 = A0; // temperature sensor to arduino pin A0
void setup() {
lcd.begin(16, 2);
lcd.print("Welcome");
delay(1000);
lcd.clear();
lcd.print("Temp= ");
pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
}
void loop() {
// Section for the temperature sensor
int value = analogRead(TMP36);
float Temperature = value * 500.0 / 1023.0;
lcd.setCursor(6,0);
lcd.print(Temperature);
if (Temperature > 60){
lcd.setCursor(0,1);
lcd.print("Fire!");
tone(buzzer, 5000); // Send 1KHz sound signal...
delay(1000); // ...for 1 sec
noTone(buzzer); // Stop sound...
delay(1000); // ...for 1sec
}
else {
noTone(buzzer); // Stop sound...
lcd.setCursor(0,1);
lcd.print("Safe");
}
}