Button.cpp
// static bool pressFlag = true; 
static bool pressFlag = true.
static bool pressFlag = true .
void Button::loopStep()
  {      
     bool isPressedNow = digitalRead(pin) == LOW;
     if (isPressedNow == pressed)
     {
      duration = millis() - lastChangeTime;
     }
     else
     {
      duration = 0;
      lastChangeTime = millis();
     }
    pressed = isPressedNow;
  }
void Button :: loopStep ( ) { bool isPressedNow = digitalRead ( pin ) == LOW ; if ( isPressedNow == pressed ) { duration = millis ( ) - lastChangeTime ; } else { duration = 0 ; lastChangeTime = millis ( ) ; } pressed = isPressedNow ; }
static bool pressFlag = true;
static bool pressFlag = true ;