int ldrPin = A0; // Define the LDR pin
int ledPin = 13; // Define the LED pin
void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
Serial.begin(9600); // Begin serial communication for monitoring
}
void loop() {
int ldrValue = analogRead(ldrPin); // Read the LDR value
int delayTime = map(ldrValue, 0, 1023, 100, 1000); // Map the LDR value to a delay
digitalWrite(ledPin, HIGH); // Turn the LED on
delay(delayTime); // Delay based on light intensity
digitalWrite(ledPin, LOW); // Turn the LED off
delay(delayTime); // Delay again for blinking effect
Serial.println(ldrValue); // Print the LDR value for debugging
}