Need 2nd set of eyes on simple code question

I have 3 input pins with internal pullups enabled on a '1284P board.
I can see with a scope that they go low.
I have previously tested with digitalRead & serial print that can be read as High & Low.

void setup(){
  
  pinMode(2, INPUT);
  pinMode (3, INPUT);
  pinMode (4,INPUT);
  digitalWrite (2, HIGH);
  digitalWrite (3, HIGH);
  digitalWrite (4, HIGH);
  Serial.begin(115200);
}
void loop(){
  if (digitalRead(2) == LOW){Serial.print("2");}
  if (digitalRead(3) == LOW){Serial.print("3");}
  if (digitalRead(4) == LOW){Serial.print("4");}
  delay(100);
}

What am I now doing wrong that I can't get past this while statement when any one of them goes low?
All three are defined as inputs with digitalWrite High to enable the pullups.

    while ( ((PIND & 0b00000100) == 0) || ((PIND & 0b00001000) == 0) || ((PIND & 0b00010000) == 0) ){
      // waiting for low trigger on PD-2/D2 or PD-3/D3 or PD-4/D4
    }
    Serial.println("triggered"); // for debug

Shouldn't (PINB & 0b00000001) be for D4 Rather than (PIND & 0b00010000) == 0) ?

Try:
while ( ((PIND & 0b00000100) == 0) || ((PIND & 0b00001000) == 0) || ((PINB & 0b00000001) == 0) ){

D'oh!
You are right. Can't believe I did that. I didn't try the other 2 with the while code since they are awkward BNC connectors.

// ATMEL ATMEGA1284P on Bobuino
//
//                       +---\/---+
//           (D 4) PB0 1 |        | 40 PA0 (D 21) AI 7
//           (D 5) PB1 2 |        | 39 PA1 (D 20) AI 6
//      INT2 (D 6) PB2 3 |        | 38 PA2 (D 19) AI 5
//       PWM (D 7) PB3 4 |        | 37 PA3 (D 18) AI 4
//   PWM/SS (D 10) PB4 5 |        | 36 PA4 (D 17) AI 3
//     MOSI (D 11) PB5 6 |        | 35 PA5 (D 16) AI 2
// PWM/MISO (D 12) PB6 7 |        | 34 PA6 (D 15) AI 1
//  PWM/SCK (D 13) PB7 8 |        | 33 PA7 (D 14) AI 0
//                 RST 9 |        | 32 AREF
//                VCC 10 |        | 31 GND 
//                GND 11 |        | 30 AVCC
//              XTAL2 12 |        | 29 PC7 (D 29) 
//              XTAL1 13 |        | 28 PC6 (D 28) 
//      RX0 (D 0) PD0 14 |        | 27 PC5 (D 27) TDI
//      TX0 (D 1) PD1 15 |        | 26 PC4 (D 26) TDO
// INT0 RX1 (D 2) PD2 16 |        | 25 PC3 (D 25) TMS
// INT1 TX1 (D 3) PD3 17 |        | 24 PC2 (D 24) TCK
//     PWM (D 30) PD4 18 |        | 23 PC1 (D 23) SDA
//      PWM (D 8) PD5 19 |        | 22 PC0 (D 22) SCL
//      PWM (D 9) PD6 20 |        | 21 PD7 (D 31) PWM
//                       +--------+
//

while ( (PIND & 0b00001100) == 0) || ((PINB & 0b00000001) == 0) ) ; // wait for low on PD-2/D2 or PD-3/D3 or PD-4/D4

you can test both PIND pins in one test (gain some nano seconds :wink:

It is possible to test both PIND pins in a single test, but the way shown won't work. The way that was shown requires BOTH PIND pins to go low, not just either one alone.

@vaj4088
you're right , back to the original question

What am I now doing wrong that I can't get past this while statement when any one of them goes low?

you want to have a // wait while all pins are high
while ( ( PIND & 0b00001000 == 0b00001000 ) && (PIND & 0b00000100 == 0b00000100 ) && (PINB && 0b00000001 == 1) ;

to be abbreviated
while ( ( PIND & 0b00001100 == 0b00001100 ) && (PINB && 0b00000001 == 1) ;

Thanks, can give it a try. For sure, only one will happen at a time. Two are button presses, the 00000100 is a 20KHz square wave. The two manual buttons are working, will check out the 20KHz tonight, got a Duemilanove simulating that source.