#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int pir=2;
int buz=12;
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
pinMode(pir, INPUT);
pinMode(buz,OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int val=digitalRead(pir);
Serial.print(val);
if(val==0){
digitalWrite(buz,HIGH);
delay(100);
digitalWrite(buz, LOW);
delay(100);
lcd.setCursor(0,0);//row,col
lcd.print("some one come");
}
else{
digitalWrite(buz, LOW);
lcd.setCursor(0,1);//row,col
lcd.print("no one there");
}
}