input from keypad and microcontroller
can you guys help me with: how to input a value from a keypad (say a keypad having 4 numbers; 1,2,3 and 4) into a microcontroller and the latter reads the number entered?
e.g. i want the microcontroller to know that my system must shutdown when the bump sensor reads '2', i.e it hits something twice. So when i pressed the key '2', the microcontroller gets the value '2' and will compare it with the bump count. But i don't know how to do it.😕
i am thinking of using 4 different switches, each defining numbers 1 to 4. but this would occupy 4 ports.. so guys can this be done using ONLY ONE PORT? 😒
please reply soon.
regards,
Satanas