#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);
int i=1;
void setup() {
// put your setup code here, to run once:
pinMode(19, INPUT);
lcd.init();
lcd.backlight();
lcd.setCursor(0,0);
//lcd.print("HELLO");
Serial.begin(115200);
Serial.println("Hello, ESP32!");
}
void loop() {
// put your main code here, to run repeatedly:
int y = digitalRead(19);
Serial.println(y);
if (y==1){
lcd.setCursor(0,0);
lcd.print("Motion ");
lcd.setCursor(0,1);
lcd.print(i);
i++;
delay(3000);
}
else{
lcd.setCursor(0,0);
lcd.print("noMotion ");
}
//delay(10); // this speeds up the simulation
}