const short triggerThreshold = 500;// Lower is more sensitive;
   int potato = 0;
void setup() {
  pinMode(A0, INPUT);
  Serial.begin(9600);
  delay(1);
  pinMode(2, OUTPUT);

}

void loop() {
  short value = analogRead(A0);
  Serial.println(value);
  if (value > triggerThreshold){
    Serial.println("Activated!");
    potato++;

    
  }
  else{
    potato = 0;
    Serial.println("dun");
    digitalWrite(2,HIGH);
  }
  if (potato > 20){
    Serial.println("true");
    digitalWrite(2,LOW);
  }
  
  delayMicroseconds(10000);// 10ms;
}
