#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
const int ldrPin = A0; // Analog pin connected to the LDR
void setup() {
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print(" WELCOME TO ");
lcd.setCursor(0, 1);
lcd.print(" CIRCUIT DIGEST ");
delay(2000);
lcd.clear();
Serial.begin(9600);
}
void loop() {
int ldrValue = analogRead(ldrPin);
lcd.setCursor(0, 0);
lcd.print("LDR Value: ");
lcd.print(ldrValue);
// Set conditions here based on the analog reading
if (ldrValue > 100 && ldrValue < 250) {
lcd.setCursor(0, 1);
lcd.print("Received 1");
// Perform necessary actions if signal is detected
} else if (ldrValue > 250 && ldrValue < 500) {
lcd.setCursor(0, 1);
lcd.print("Received 2");
} else if (ldrValue > 500 && ldrValue < 1000) {
lcd.setCursor(0, 1);
lcd.print("Received 3");
} else {
lcd.setCursor(0, 1);
lcd.print("No signal");
// Perform necessary actions if no signal is detected
}
delay(1000); // Delay for stability
}