user6224: i am tring to enter a series of numbers using "keypad" to different variables..when simulate the code on proteus it only took the first "getkey()" function and ignored the rest .. 
SO,
How can i block an arduino code until a key is pressed by keypad, in other words prevent the rest of code from being executed before a key is pressed 

user496: It depends on how the "keypad" is implemented. If you've got it hooked up to a hardware interrupt, then you only need to add an interrupt handler for that event.
On the other hand, the more "straight-forward" implementation is that you have to poll the pins to see if a key was pressed.  Simply do that in a loop until you see a key press, call your event-handler method, and then continue to loop.

6224: <p>i am tring to enter a series of numbers using "keypad" to different variables..when simulate the code on proteus it only took the first "getkey()" function and ignored the rest .. 
SO,
How can i block an arduino code until a key is pressed by keypad, in other words prevent the rest of code from being executed before a key is pressed </p>
 496: <p>It depends on how the "keypad" is implemented. If you've got it hooked up to a hardware interrupt, then you only need to add an interrupt handler for that event.</p>

<p>On the other hand, the more "straight-forward" implementation is that you have to poll the pins to see if a key was pressed.  Simply do that in a loop until you see a key press, call your event-handler method, and then continue to loop.</p>
