const int ldrPin = A0;      // Analog input pin for the LDR
const int buttonPin = 2;    // Digital input pin for the push button
const int ledPin = 9;       // Digital output pin for the LED

void setup() {
  pinMode(ldrPin, INPUT);
  pinMode(buttonPin, INPUT_PULLUP);  // Internal pull-up resistor for the push button
  pinMode(ledPin, OUTPUT);
  Serial.begin(9600);
}

void loop() {
  int ldrValue = analogRead(ldrPin);
  int buttonState = digitalRead(buttonPin);

  Serial.print("LDR Value: ");
  Serial.println(ldrValue);
  
  Serial.print("Button State: ");
  Serial.println(buttonState);

  // Control the LED based on LDR value and button state
  if (ldrValue < 500 && buttonState == HIGH) {
    digitalWrite(ledPin, HIGH);  // Turn on the LED
  } else {
    digitalWrite(ledPin, LOW);   // Turn off the LED
  }

  delay(500); 
}