// #include <Arduino.h>
#define BTN_UP 2
bool state = false;
int count = 0;

void setup() {
  // put your setup code here, to run once:
  pinMode(BTN_UP, INPUT_PULLUP);
  Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:

  // if (digitalRead(BTN_UP) != state){
  //   // while(digitalRead(BTN_UP) != state){}
  //   state = !state;
  //   count++;
  //   Serial.print(state);
  //   Serial.print(", ");
  //   Serial.println(count);
  // }

  if (digitalRead((BTN_UP)) == LOW) {
    int intervalCount = 0;
    count++;
    Serial.println(count);

    while (digitalRead((BTN_UP)) == LOW) {
      intervalCount++;
      if (intervalCount > 10) {
        count++;
        if (intervalCount > 12) intervalCount--;
        Serial.println(count);
      }
      delay(100);
    }
  }

  delay(100);
}