#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup() {
lcd.init(); // initialize the lcd
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("LDR Resistance:");
}
void loop() {
int sensorValue = analogRead(34); // Use the correct analog pin
float voltage = sensorValue * (3.3 / 4095.0);
float resistance = (3.3 - voltage) * 10000 / voltage; // Calculate resistance
lcd.setCursor(0, 1);
lcd.print(resistance);
lcd.print(" Ohms");
delay(500);
}