//lcd ir sensor
#include <Wire.h> // Include the Wire library for I2C communication
#include <LiquidCrystal_I2C.h> // Include the LiquidCrystal_I2C library for I2C LCD
LiquidCrystal_I2C lcd(0x27, 16, 2); // Define the LCD address and dimensions (16x2)
#define IR_PIN 7 // Define the pin for the IR sensor input
void setup() {
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
pinMode(IR_PIN, INPUT); // Set the IR pin as input
}
void loop() {
// Read IR sensor data
int irData = digitalRead(IR_PIN);
// Print IR sensor data on LCD
lcd.clear(); // Clear the LCD
lcd.setCursor(0, 0); // Set cursor to the first row
lcd.print("IR Sensor Data:"); // Print on LCD
lcd.setCursor(0, 1); // Set cursor to the second row
lcd.print(irData); // Print IR sensor data on LCD
delay(1000); // Delay for readability (1 second)
}