int ldr = A2;    
int led = 2;
int button = 8;
int threshold=1023, value;

void setup() {
  Serial.begin(9600);
  pinMode(button, INPUT); 
  pinMode(led, OUTPUT);    
}

void loop() {
  value = analogRead(ldr); 
  if (value>threshold+20){
    digitalWrite(led, HIGH);  
  }
  threshold=value;
  if (digitalRead(button)==HIGH){
    digitalWrite(led, LOW);  
  }
  delay(500);                  
}
