pause code not working

I have two buttons that when pressed individually start its counterpart led display, that part works great. Yet I want to pause the led displays when both buttons are pressed, until a single button is pressed later. Right now when I let go of the two buttons, whichever was let go slightly later will start counting down. Here is the pertinent code:

detects if both buttons are held down:

  else if(button1==1 && button2==1){    //if both buttons are held down the hold variable becomes 3 and both clocks stop
    delay(5000);
    hold=3;
  }

keeps the loop there (paused) until a single button is pressed:

while(hold == 3){

button1 = digitalRead(inPin1); // read the input pin for button 1
button2 = digitalRead(inPin2); // read the input pin for button 2

if(button1 == 1){
hold = 1;
break;
}
else if(button2 == 1){
hold = 2;
break;
}
}

hold will never be 3 (from the code you show...) It will be 2, or 1 because you assign it to be either.

Unless you meant to do this:

while(hold == 3){

hold=0; button1 = digitalRead(inPin1); // read the input pin for button 1
button2 = digitalRead(inPin2); // read the input pin for button 2

if(button1 == 1){
hold |= 1;
break;
}
else if(button2 == 1){
hold |= 2;
break;
}
}

It is not clear to me what you meant to do if that doesn't solve your problem - you may have to elaborate more.

The first block of code I pasted sets hold to 3 if both buttons are held down. Once hold==3 the code remains in the while loop (second block of code I pasted) until either button is pressed. Hold becomes either 1 or 2 depending on the button that is pushed, at which time the code breaks out of the while loop and back into the normal loop structure where it can run one of the displays.

I can post the code in its entirety if needed.

Oh, ok... Now I see.

You want to do this:

  1. When Both are pressed -
  2. wait for the release of both
  3. Wait for a second button press
  4. act on that button press

Is that what you want to accomplish?

Yup thats what I want to do.

At the moment I can easily pause my code by adding another switch (non-momentary), but I would like to do it using the two existing momentary buttons.

Whatever the logic you implement, I think you will need to do some "debouncing" of the button. See this note: http://arduino.cc/en/Tutorial/Debounce for a brief tutorial.