Same timing variable returning two different times

I have some diagnostic LEDs set up to check if certain states are triggering while I test my code. I've set two of them up to blink if the a state is true. I used the same code running the same blink rate on both but one is blinking at 500ms and one is blinking at 5000ms. Any idea what is causing this?

Relevant code

//Status light blink
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long blinkPeriod = 600;

void setup()
{
pinMode(ledPinStatus, OUTPUT);
pinMode(ledPinStatus2, OUTPUT); //debug pin
}

void loop()
{

//Status light
//---------------------------------------------------------------------------
if (Reset == true && Edit == false)
{ digitalWrite(ledPinStatus, LOW); }

if (Reset == false && Edit == false)
{    digitalWrite(ledPinStatus, HIGH);   }

//Blink timer
//---------------------------------------------------------------------------
currentMillis = millis(); //get the current "time" (actually the number of milliseconds since the program started)
if (currentMillis - startMillis >= blinkPeriod && Edit == true ) //test whether the period has elapsed
{
digitalWrite(ledPinStatus, !digitalRead(ledPinStatus));
startMillis = currentMillis;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

//Utility
//---------------------------------------------------------------------------
if (Edit == false)
{ digitalWrite(ledPinStatus2, LOW); }

if (Edit == true && EditDelay == false)
{    digitalWrite(ledPinStatus2, HIGH);   }

currentMillis = millis();
if (currentMillis - startMillis >= blinkPeriod && Edit == true && EditDelay == true)
{
digitalWrite(ledPinStatus2, !digitalRead(ledPinStatus2));
startMillis = currentMillis;
}
}

Full code
int ledPinRed = 5;
int ledPinGreen = 6;
int ledPinStatus = 3;
int ledPinStatus2 = 9; //debug pin

int buttonNeg = 8;
int buttonPos = 7;
int buttonTrig = 10;
int buttonClr = 11;
int buttonEdit = 2;

// Control

int Reset = false;
int Edit = false;
int EditDelay = false;
int maxReadDelay = 10000;
int ReadDelay = maxReadDelay;
int maxBrightness = 255; //this can be any number - it's the number of steps between dimmest and brightest.
int brightness = maxBrightness;
int interval1=10; //LED brightness
int interval2=1000; //result delay

// Results

int Zombie = false;
int Human = false;

// Misc

//Status light blink
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long blinkPeriod = 600;

void setup()
{
pinMode(ledPinRed, OUTPUT);
pinMode(ledPinGreen, OUTPUT);
pinMode(ledPinStatus, OUTPUT);
pinMode(ledPinStatus2, OUTPUT); //debug pin
pinMode(buttonNeg, INPUT_PULLUP);
pinMode(buttonPos, INPUT_PULLUP);
pinMode(buttonTrig, INPUT_PULLUP);
pinMode(buttonClr, INPUT_PULLUP);
pinMode(buttonEdit, INPUT_PULLUP);
}

void loop()
{

//POSITIVE
//---------------------------------------------------------------------------
if (digitalRead(buttonPos) == LOW && Edit == false && Human == false)

{ Zombie = true;
Human = false; }

 if (digitalRead(buttonTrig) == LOW && Zombie == true && Edit == false)

{ delay (ReadDelay);
analogWrite(ledPinRed, brightness); }

//---------------------------------------------------------------------------

//NEGATIVE
//---------------------------------------------------------------------------
if (digitalRead(buttonNeg) == LOW && Edit == false && Zombie == false)

{ Human = true;
Zombie = false; }

if (digitalRead(buttonTrig) == LOW && Human == true && Edit == false)

{ delay (ReadDelay);
analogWrite(ledPinGreen, brightness); }

//---------------------------------------------------------------------------

//RESET
//---------------------------------------------------------------------------
if (digitalRead(buttonClr) == LOW && Reset == false && Edit == false)
{
delay(500);
Reset = true;
}

if (digitalRead(buttonClr) == LOW && Reset == true && Edit == false)
{
digitalWrite(ledPinRed, LOW);
digitalWrite(ledPinGreen, LOW);
Zombie = false;
Human = false;
delay(500);
Reset = false;
}
//---------------------------------------------------------------------------

//EDIT MODE
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

//Mode switch
//---------------------------------------------------------------------------
if (digitalRead(buttonEdit) == LOW && Edit == false)
{ delay(500);
Edit = true; }

if (digitalRead(buttonEdit) == LOW && Edit == true)
{ delay(500);
Edit = false;
EditDelay = false;
}

//Intensity
//---------------------------------------------------------------------------

if (digitalRead(buttonNeg) == LOW && brightness < maxBrightness && Edit == true && EditDelay == false)
{ 
  brightness += interval1;
  delay(100);
  analogWrite(ledPinRed, map(brightness, 0, maxBrightness, 0, 255));
  analogWrite(ledPinGreen, map(brightness, 0, maxBrightness, 0, 255));

  
}
   
if (digitalRead(buttonPos) == LOW && brightness > 0 && Edit == true && EditDelay == false)
{
  brightness -= interval1;
  delay(100);
  analogWrite(ledPinRed, map(brightness, 0, maxBrightness, 0, 255));
  analogWrite(ledPinGreen, map(brightness, 0, maxBrightness, 0, 255));

}

//Read Delay
//---------------------------------------------------------------------------

if (digitalRead(buttonTrig) == LOW && Edit == true && EditDelay == false)
{ 
delay (500);
EditDelay = true;
}

if (digitalRead(buttonTrig) == LOW && Edit == true && EditDelay == true)
{
delay (500);
EditDelay = false;
}

if (digitalRead(buttonNeg) == LOW && ReadDelay < maxReadDelay && Edit == true && EditDelay == true)
{ 
  ReadDelay += interval2;
 

   
}

 if (digitalRead(buttonPos) == LOW && ReadDelay < maxReadDelay && Edit == true && EditDelay == true)
{ 
  ReadDelay -= interval2;
 
   
}

//Status light
//---------------------------------------------------------------------------
if (Reset == true && Edit == false)
{ digitalWrite(ledPinStatus, LOW); }

if (Reset == false && Edit == false)
{    digitalWrite(ledPinStatus, HIGH);   }

//Blink timer
//---------------------------------------------------------------------------
currentMillis = millis(); //get the current "time" (actually the number of milliseconds since the program started)
if (currentMillis - startMillis >= blinkPeriod && Edit == true ) //test whether the period has elapsed
{
digitalWrite(ledPinStatus, !digitalRead(ledPinStatus));
startMillis = currentMillis;
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------

//Utility
//---------------------------------------------------------------------------
if (Edit == false)
{ digitalWrite(ledPinStatus2, LOW); }

if (Edit == true && EditDelay == false)
{    digitalWrite(ledPinStatus2, HIGH);   }

currentMillis = millis();
if (currentMillis - startMillis >= blinkPeriod && Edit == true && EditDelay == true)
{
digitalWrite(ledPinStatus2, !digitalRead(ledPinStatus2));
startMillis = currentMillis;
}

//---------------------------------------------------------------------------

}

CAREFUL, you could get suspended if you post the same question in multiple places…
LIKE THIS

Please edit your post and place your sketch in code tags.


In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
Use the </> icon from the ‘reply menu’ to attach the copied sketch.

Please read: How to get the best out of this forum

Pay attention to the part about code tags.

This is not the same issue. The button works fine now, the new issue is that what should be the same (new) code is returning two different results.

Thank you. I will do this tomorrow and fix it.

Are both supposed to be blinking at the same time? It looks like one blinks if "Edit == true" and the other blinks if "Edit == true && EditDelay == true" so if the second one is blinking, the first one is also blinking. But every time the first one blinks it resets the shared "startMillis" variable. The second one sees that the timer has not expired. Use a separate "startMillis" variable for the two blinkers to fix it.

That would do it. Thank you so much!