while(PORTD >= 16)

I understand this piece of code means wait until digital outputs 4, 5, 6 and 7 are low. But I have no clue how the 16 means that. What I am trying to do is edit it to wait until digital ports 2-7 are low.

Thanks for any help.

(deleted)

Ok, so I'd need to change it to 4?

while (PORTD >= 4) would work, but it would be a bit more obvious what was being tested if you wrote it as while ( (PORTD & B11111100 ) != 0)

Copy. Thanks!

It would be more appropriate to use the PORTD input value, which on an AVR based Arduino is PIND.

while ((PIND & 0xF0) != 0); //wait till pins 4-7 are all low