Info on using keypad

Hi everyone.

I need to interface keypad with Arduino nano. Can anyone explain how to get multiple digit data on a single go (example: getting input as 100 or 99) from user and save it for other purposes? I am very new into all this.

You need to know the basics first, so start with the examples that came with the arduino software. Once you have done that and are comfortable to go further, there is a keypad library you need to download if you don’t already have it.

The keypad library comes with it’s own examples that can get you started, but you have to add to it so you get it to collect multiple chars (term for character like ‘A’ or ‘1’) and store them in another variable.

You can use this:

char myKey = Keypad.getKey();
value = (value * 10) + (myKey - '0');

myKey is the char returned from the key you pressed.
(myKey - ‘0’) converts the char into a usable value to then be used later. ‘5’ - ‘0’ = 5
value is where you are going to concatenate in incoming chars into a multi-digit number. “1234”
(value * 10) shifts the numbers into multi-digit values.

Example:
you enter 1,7,8,5 on the keypad.
1 = (0 * 10) + (‘1’ - ‘0’);
17 = (1* 10) + (‘7’ - ‘0’);
178 = (17 * 10) + (‘8’ - ‘0’);
1785 = (178 * 10) + (‘5’ - ‘0’);
value = 1785.

So i guess, i have to keep recurring with this piece of code and also assign a key (to be pressed by user) to end this loop. Thanks a lot for the info.

also assign a key (to be pressed by user) to end this loop.

Yea, the usual method is to wait for either the * or # symbol to be pressed to stop collecting the values. Another method is to set how many chars it should receive with a counter.