const int buttonPin = 8;

unsigned long previousMillis;
const unsigned long interval = 500UL;
bool enable = false;
int count;

void setup()
{
  Serial.begin( 9600);
  Serial.println( "The sketch with millis has started");

  pinMode( buttonPin, INPUT_PULLUP);
}

void loop()
{
  unsigned long currentMillis = millis();

  if( digitalRead( buttonPin) == LOW)
  {
    count = 0;
    previousMillis = currentMillis;
    enable = true;
  }

  if( enable)
  {
    if( currentMillis - previousMillis >= interval)
    {
      previousMillis = currentMillis;

      Serial.println( "V V");
      count++;
      if( count >= 3)
      {
        Serial.println( "----------------");
        enable = false;
      }
    }
  }
}