// put your setup cod// Define the pin for the LDR
const int LDRPin = A0;
// Define the pin for the LED
const int LEDPin = 13;
void setup() {
// Initialize the serial communication
Serial.begin(9600);
// Set the LED pin as an output
pinMode(LEDPin, OUTPUT);
}
void loop() {
// Read the value from the LDR
int ldrValue = analogRead(LDRPin);
// Print the LDR value to the serial monitor
Serial.println(ldrValue);
// Check if it's dark (you may need to adjust this threshold)
if (ldrValue < 200) {
// Turn on the LED
digitalWrite(LEDPin, HIGH);
} else {
// Turn off the LED
digitalWrite(LEDPin, LOW);
}
// Delay for stability
delay(500);
}