Repeat case in a loop

Hello,

the code shown below is part of a bigger code. The completed code has four cases and I would like to add a 5th one which is the one shown below. I did get some help in getting this far with this particular case from this forum. This works ok when it stands alone. However, when I include it as part of a case it only runs once. I would like to get it to repeat 5 times and then stop.

Any ideas as to how I can do that?

#include <Servo.h>
Servo s5;
const byte buttonPin = 2;
byte currentButtonState;
byte previousButtonState = HIGH;
unsigned long buttonPressTime;
unsigned long currentTime;
unsigned long waitPeriod = 2000;
boolean timing = false;

int COUNT = 1;
int buzzerPin = 9;
int counter;
int var;
void setup()
{
  Serial.begin(9600);
  pinMode(buttonPin, INPUT_PULLUP);
  s5.attach(5);
}
void loop()
{
  currentTime = millis();
  previousButtonState = currentButtonState;
  currentButtonState = digitalRead(buttonPin);

  if (Serial.available() > 0) {
    char data = Serial.read(); // reading the data received from the bluetooth module
    switch (data)
    {
      case '1':
        Serial.println("\nTiming started");
        buttonPressTime = currentTime;
        timing = true;

        s5.write(90);
        delay(10);
    }
  }
  if (currentButtonState != previousButtonState && currentButtonState == HIGH)     //input gone HIGH
  {
    timing = false;
    s5.write(0);
    delay(700);
  }
  if ((currentTime - buttonPressTime >= waitPeriod) && timing && currentButtonState == LOW)
  {
    timing = false;
    s5.write(0);
    delay(700);
  }
  delay(10);
}

when I include it as part of a case it only runs once

Please post the complete program that you tried

Code for a case will run each time through loop() as long as the switch variable does not change