int sensor=A1;
int led = 2;
int led2 = 5;
int threshold= 10;
int state;

void setup(){
 pinMode(led, OUTPUT); 
 pinMode(led2, OUTPUT);
}

void loop(){
  if (analogRead(sensor) >= threshold)
  {
    state=LOW;
    digitalWrite(led, HIGH);
    delay(100);
    for (int t=0;t<2000;t++){
      delay(1);
      if (analogRead(sensor) >= threshold){
        state=!state;
        delay(100);
        digitalWrite(led2, state);
      }
    }
    digitalWrite(led, LOW);
    digitalWrite(led2, LOW);
  }
} 
