#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
void setup()
{
lcd.init();
lcd.clear();
pinMode(7, INPUT);
pinMode(6, OUTPUT);
}
void loop()
{
int pir=digitalRead(7);
if(pir==HIGH){
lcd.backlight();
digitalWrite(6, HIGH);
for(int i=0;i<5;i++){
lcd.setCursor(5,0);
lcd.print("ALERTA");
lcd.setCursor(5,1);
lcd.print("INTRUSO");
delay(1000);
lcd.clear();
delay(1000);
}
}
else{
digitalWrite(6, LOW);
lcd.clear();
}
}