// Define the pins for LDR (Light Dependent Resistor) and LED
const int ldrPin = A0; // LDR pin connected to analog pin A0
const int ledPin = 9;  // LED pin connected to digital pin 9

void setup() {
  pinMode(ldrPin, INPUT);  // Set LDR pin as input
  pinMode(ledPin, OUTPUT); // Set LED pin as output
}

void loop() {
  int lightValue = analogRead(ldrPin); // Read the light intensity from LDR

  if (lightValue >= 500) {
    analogWrite(ledPin, 50); // Turn on LED slightly
  } else {
    analogWrite(ledPin, 255); // Turn on LED brightly
  }

  delay(100); // Delay for stability
}