I'm programming a sequence where I have a status LED to indicate mode 1 or mode 2. There is a button that changes modes with one push. When the code is just "light on in mode 1, light off in mode 2" there are no problems.
I would like to make mode 2 light into a blink sequence instead of an off state, however when I do this it is interfering with the button press. Instead of one press to get back to mode 1, I have to now hold the button to trigger the mode change. The length of time I need to hold it depends on how long the blink delay is. There seems to be a sweet spot where the button takes the input, but I can't figure out why or how to stop it.
//EDIT MODE
if (digitalRead(buttonEdit) == LOW && Edit == false)
{ delay(500);
Edit = true; }
if (digitalRead(buttonEdit) == LOW && Edit == true)
{ delay(500);
Edit = false; }
//Status light
if (Reset == true && Edit == false)
{ digitalWrite(ledPinStatus, LOW); }
if (Reset == false && Edit == false)
{ digitalWrite(ledPinStatus, HIGH); }
//the part causing the problem
if (Edit == true)
{
delay (1000);
digitalWrite(ledPinStatus, LOW);
delay (1000);
digitalWrite(ledPinStatus, HIGH);
}