Hi everyone, I'm getting started with a new project in which I need to use a standard 4x4 keypad to input a value, (amount of times a button will be pressed) and create an output (light an LED) when the button is pushed the amount of times that the keypad was set for. Basically I'm trying to figure out how to set a limit with the keypad.
I keep looking for tutorials on this but all I can find is how to hookup a keypad and show the number input on some kind of display. I cant find any tutorials on how to actually use the input value and apply it for any useful purposes.
Can anyone post a link or point me in the right direction so I can learn more about this?
I hope my description was clear enough to understand. Thanks everybody
Have you looked at the keypad examples in the IDE ?
Once you have read a number you can use it.
yes I have but this is my first time messing with it so I'm just fumbling around and getting nowhere.
Pressing a key on the keypad will give you a character corresponding to the key pressed. Note that it is a character, not the actual number. Subtract 48 from the character representing a number and you have the actual number. Put it in a variable and use it how you like. Note that this applies to single number only.
Want multiple digit numbers ?
Declare an int variable to hold the total number and set it to zero. Read a key from the keypad, subtract 48, multiply the number variable by 10 and add the number you got from the keypad to the total. Keep going until you have the required number of digits.
How do you know when you are finished reading digits ?
Either count them and stop reading when done or have the user press a special key, perhaps '#', but you choose.
Now you have a much larger number in the total variable to use how you like.
Bob, thanks yet again! that is exactly the info I was looking for