#define LDR_PIN 34 // Analog pin connected to the LDR
void setup() {
// Initialize Serial Monitor
Serial.begin(115200);
Serial.println("LDR Light Sensor Example");
}
void loop() {
// Read the analog value from the LDR int ldrValue = analogRead(LDR_PIN);
int ldrValue=analogRead(LDR_PIN);
// Map the analog value to a percentage (optional, int lightLevel = map(1drValue, 0, 4095, 0, 100);
int lightLevel=map (ldrValue,0,4095,0,100);
// Print the raw analog value and light level perc
Serial.print("Raw LDR Value: ");
Serial.print(ldrValue);
Serial.print(" | Light Level: ");
Serial.print(lightLevel);
Serial.println("%");
delay(500); // Delay for readability
}