Getting a 4-digit number from a keypad

After recognising a key press you must wait until no keys are pressed
before sensing a new one - your current code will simply loop 4 times in
a few microseconds on the first keypress.