Untitled
#include<LiquidCrystal.h> int PIRPin = 3; bool motionDetected = false; LiquidCrystal lcd(1, 2, 4, 5, 6, 7); void setup() { pinMode(PIRPin, INPUT); lcd.begin(16, 2); //lcd initialize } void loop() { motionDetected = digitalRead(PIRPin); if (motionDetected) { lcd.clear(); lcd.setCursor(0, 0); lcd.print("Motion Detected!"); delay(500); } else { lcd.clear(); lcd.setCursor(3, 0); lcd.print("Motion Not"); lcd.setCursor(4, 1); lcd.print("Detected"); delay(500); } }
Leave a Comment