press and hold, remove the dead button?

Problem One is the easy one I think: I only want the Pump to activate when the button is held. Once I let go, it turns off. I thought this code would work:

void loop() {

...
...
...


else if (digitalRead(BUTTON3_PIN) == LOW) {   //PumpOverride
  delay(5);                                   //debounce
    PumpOverride();
    }


void PumpOverride() {

  if (PumpStatus == false) {
     PumpStatus = !PumpStatus;
     digitalWrite(PUMP_PIN, PumpStatus);       
     
     while (digitalRead(BUTTON3_PIN) == LOW);  // don't I need a {} brackets after while?
  }  
  else {                                        //turns OFF pump if already ON when this function is executed
     PumpStatus = !PumpStatus;
     digitalWrite(PUMP_PIN, PumpStatus);
  }
}

The second question is perhaps not so easy. My void loop (above) has a bunch of calculations happening every 10 seconds, so a full loop cycle when executing those calculations takes about 2 seconds. As I have it set up now, if those calculations are running when I click the button - nothing happens. Makes sense.
Is there a way around this? Instead of having the calculations run within the void loop, can I have them run outside/parrallel, or is there an intelligent way to avoid this "dead button" effect from happening?

Too many questions, not enough code. Lets see it all!

And perhaps explain, in human, what you want it to do?

-jim lee

Yes, it is done with "round robin cooperative multitasking" a.k.a. "more than one thing at a time". See the forum help threads at the top for details.

Your question 1, you probably (I say probably, because yes, I would like to see all your code not just snippets) don't have any state change detection. You incorrectly look at when the switch IS low, not when it BECOMES low.

kalkulate:
My void loop (above) has a bunch of calculations happening every 10 seconds, so a full loop cycle when executing those calculations takes about 2 seconds. As I have it set up now, if those calculations are running when I click the button - nothing happens. Makes sense.
Is there a way around this?

How on earth can calculations take 2 seconds?? I suppose you are taking some sensor readings over a 2-second span, and then at the end of that 2 seconds doing something with them?

kalkulate:
The second question is perhaps not so easy. My void loop (above) has a bunch of calculations happening every 10 seconds, so a full loop cycle when executing those calculations takes about 2 seconds. As I have it set up now, if those calculations are running when I click the button - nothing happens. Makes sense.

Have a look at how the code is organized in Several Things at a Time

Note how each function runs very briefly and returns to loop() so the next one can be called. None of the functions tries to complete a task in one call. And there may be dozens of calls to a function before it is actually time for it to do anything.

...R

Presumably the hidden code contains delay() statements.
It is better to use a timer based on millis() instead of delay().
In desperation, there are methods of skipping over a series of delay() statements using an interrupt and series of flags to escape from delay groups.