#include <LiquidCrystal_I2C.h>
const LiquidCrystal_I2C LCD(0x27, 16, 2);
const byte sensorPin = 3;
void inputFromSensor() {
LCD.init();
LCD.print("Motion Detected!");
delay(100);
LCD.init();
LCD.print("No Motion");
}
void setup() {
// put your setup code here, to run once:
pinMode(sensorPin, INPUT_PULLUP);
LCD.init();
LCD.backlight();
LCD.setCursor(0, 0);
LCD.print("No Motion");
}
void loop() {
// put your main code here, to run repeatedly:
if (digitalRead(sensorPin) == HIGH) {
inputFromSensor();
}
}