i found something that needs to be modified
unsigned long currentTime;
unsigned long loopTime;
void setup()
{
currentTime = millis();
loopTime = currentTime;
pinMode(12, OUTPUT); //Initialize pin 12 as status LED
pinMode(8, INPUT); // Our button pin
}
void loop()
{
if (digitalRead(8) == LOW) // Switch is closed to start LED timer
{
digitalWrite(12, HIGH); // LED comes On
currentTime = millis();
}
else //Hits each pass that switch is not pressed
{
if (currentTime >= (loopTime + 5000)); {
digitalWrite(12, LOW); // LED goes off
loopTime = currentTime; // Updates loopTime
}
}
}