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.
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
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.