#include <LiquidCrystal.h>
// Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 10, 9, 8, 7);
const int pirPin = 2; // Pin where the PIR sensor is connected
const int ledPin = 6; // Pin where the LED is connected
int motionDetected = 0;
void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
// Set up the LCD's number of columns and rows
lcd.begin(16, 2);
lcd.print("No motion");
}
void loop() {
motionDetected = digitalRead(pirPin);
lcd.clear();
if (motionDetected) {
lcd.setCursor(0, 0);
lcd.print("Hello");
lcd.setCursor(0, 1);
lcd.print("😊"); // Smiley face emoji
digitalWrite(ledPin, HIGH); // Turn on the LED
} else {
lcd.setCursor(0, 0);
lcd.print("No motion");
digitalWrite(ledPin, LOW); // Turn off the LED
}
delay(100); // Update rate
}