#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2); // Change the address if your I2C module has a different address
const int irSensorPin = 12; // IR sensor pin connected to digital pin 13
void setup() {
lcd.init(); // Initialize the LCD
lcd.backlight(); // Turn on the backlight
lcd.setCursor(0, 0); // Set cursor to first row
// Print project name
lcd.print("SIGN LANGUAGE");
pinMode(irSensorPin, INPUT);
// Set cursor to second row
lcd.setCursor(0, 1);
// Initialize Serial communication
Serial.begin(9600);
}
void display()
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("SIGN LANGUAGE");
lcd.setCursor(0, 1);
//lcd.print(msg);
}
void loop() {
// Read the value from IR sensor
int irSensorValue = digitalRead(irSensorPin);
// Print the value to Serial Monitor for debugging
Serial.println(irSensorValue);
// Set cursor to first row
lcd.setCursor(0, 0);
Serial.print(irSensorValue);
// Check if IR sensor value is LOW (0)
if (irSensorValue == 0) {
display();
// If value is LOW, print "Water"
lcd.print("WATER");
delay(1000);
} else {
display();
// If value is not LOW, print "Nothing"
lcd.print(" NOTHING ");
delay(1000);
}
}