Modified HourGlass - Blink then Off

Hello! First time using Arduino and this Forum!
I am trying to modify the HourGlass project. I added the blinking of the LEDs after all of them are lit. Now I am trying to just turn all the LEDs off after 5 blinks and then whenever I use the switch, then start the program again. (I want to do this because in the future I want to add the Clock Real Time and turn the HourGlass with an alarm). I have been working on the program and so far i got it to turn off on the first run (LED blinks 5 times, then turn off…YAY), but once I pressed the bottom again…the LED does not blink nor turn off…If i take out the addition for turning off the LEDs, then whenever i precess the bottom the LED blink every time. I have tried many variations without any luck :frowning: . Can some one please help me? As my Christmas present? Thanks in advance!

Code Below:

//hourGlass Program that work by switch
//Global Variables:
//Tilt Switch
const int swtchPin = 8;

//Variable Type that will hold the time an LED was last changed
unsigned long previousTime = 0;

//These two variables will compared the switchs position from one loop to another
int switchState = 0;
int prevswitchState = 0;

//Variable LED that will be used to count which LED is the next to be on, start with pin#2
int LED = 2;
// This will count by blinking after the timer is over.
int c = 0;

int t=0;

//Variable to be the time interval. this will be counting for 10 minutes. if less, change #.
//60,000 is equal to 10 mintures. it is counting in milli-seconds. i have it for 5 sec (5000).
long interval = 5000;

//Declare LEd pins 2-7 as outputs (and by using "For(), i am declaring all six as output
//Switch is declared as input.
void setup() {
for(int x = 2; x < 8; x++) {
pinMode(x, OUTPUT);
}
pinMode(swtchPin, INPUT);
}

//loop to get the amount of time the arduino has been running with mills() and store it on currentTime
//current time substract prevuis time (starts with 0) and check to see if is greater then interval (60,000)
//if it is, then previuistime will be the value of current time
//and then an LED will light up (starts with pin#2 and then add 1 (by using x++). By using LED++, the next LED will turn on
void loop() {
unsigned long currentTime = millis();
if (currentTime - previousTime > interval) {
previousTime = currentTime;
digitalWrite(LED, HIGH);
LED++;

// When all 6 LEDs are on, wait 0.1 sec and then blink
if(LED > 7){
delay(100);
c = 0;

// This is for turning off the LEDs after 5 blinks.
while(t<5){
for(int x = 2; x < 8; x++) {
digitalWrite(x, LOW);
}

//This sction is for blinking the LEDs
while (c < 5){
for(int x = 2; x < 8; x++) {
digitalWrite(x, LOW);
}
delay(250);
for(int x = 2; x < 8; x++) {
digitalWrite(x, HIGH);
}
delay(250);
c++;
}
// Counting how many blinks
t++;
}

}

}

switchState = digitalRead(swtchPin);
if(switchState != prevswitchState) {
for(int x = 2; x < 8; x++){
digitalWrite(x, LOW);
}
LED=2;
previousTime = currentTime;
}
prevswitchState = switchState;
}

First time using Arduino and this Forum!

Welcome to the forum

Did you Read this before posting a programming question ? If so you missed some important parts such as using code tags when posting code and giving full details of your project. For instance what is "the HourGlass project" ?