Project 8 Digital Hourglass

I am trying to modify the code of this project so that the led connected to pin 7 blinks after all the leds are on but I can't figure out how to do that. I would greatly appreciate any help with this and the code i am using now is:

const int switchPin = 8;
unsigned long previousTime = 0;
int switchState = 0;
int prevSwitchState = 0;
int led = 2;
long interval = 1000;
void setup() {
for(int x = 2;x<8;x++){
pinMode(x, OUTPUT);
}
pinMode(switchPin, INPUT);
}
void loop(){
unsigned long currentTime = millis();
if(currentTime - previousTime > interval) {
previousTime = currentTime;
digitalWrite(led, HIGH);
led++;
if(led == 7);
}
switchState = digitalRead(switchPin);
if(switchState != prevSwitchState){
for(int x = 2;x<8;x++){
digitalWrite(x, LOW);
previousTime = currentTime;
}
}
prevSwitchState = switchState;
}

    if (led == 7);

Is this part of the original code or is it something that you have changed.

NOTE - I used code tags rather than quoting the code.

UKHeliBob:

    if (led == 7);

Is this part of the original code or is it something that you have changed.

NOTE - I used code tags rather than quoting the code.

That is part of the code the only thing i changed was the time it takes to count down

That is part of the code

That part of the code accomplishes nothing. You need to post the original code, or a link to it.

The code you posted turns another LED on, if the interval between now and the last time an LED changed state is greater than the threshold. It looks like it tries to do something when the last LED has been turned on. But, that code appears to be missing, so we can't tell what it is supposed to do.

Clearly, led will have the value 7 when the last LED is turned on, so that would be where you would make the 7th LED change state instead of just turning on.

Sorry for the confusion :slight_smile: ! That is the whole code that i got from the arduino starter kit I was just saying that one part of the code was already in it.