#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD address to 0x27 for a 16 chars and 2 line display
const int pirPin = 2;
const int lm35Pin = A0;
void setup() {
pinMode(pirPin, INPUT);
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("Security System");
delay(2000);
lcd.clear();
}
void loop() {
int pirState = digitalRead(pirPin);
int tempValue = analogRead(lm35Pin);
float temperature = (tempValue * 5.0 * 100.0) / 1024.0;
lcd.setCursor(0, 0);
if (pirState == HIGH) {
lcd.print("Motion Detected!");
} else {
lcd.print("No Motion ");
}
lcd.setCursor(0, 1);
lcd.print("Temp: ");
lcd.print(temperature);
lcd.print(" C");
delay(1000);
}