1

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

asked Dec 14, 2014 at 16:06
2
  • 1
    Please post your code here. We don't have crystal balls here :) Commented Dec 14, 2014 at 16:51
  • 1
    And a wiring diagram or schematic, since this is hardware-based as well. Commented Dec 14, 2014 at 17:09

1 Answer 1

1

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.

answered Dec 14, 2014 at 18:59
1
  • thanks a lot, I used waitForKey() function from keypad library and it worked correctly :) Commented Dec 15, 2014 at 5:25

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.