Wednesday, 22 April 2015

Texting interface for Matrix Keypad

Once I had finished the last tutorial on the keypad, I wanted to find a secondary use for it. Using a old mobile with a key based interface for inspiration I created a 12 button alphanumeric string input device.

Wiring

The wiring is the same as in my other tutorial found here http://samthetinkerer.blogspot.co.uk/2015/03/matrix-keypad-fun.html

Code


The code is set up so that pressing the same button multiple times will cycle through the chars. For example pressing 6 three time will get you a O.

key code for the buttons are as follows

1 = _ / 1
2 = A B C 2
3 = D E F 3
4 = G H I 4
5 = J K L 5
6 = M N O 6
7 = P Q R S 7
8 = T U V 8
9 = W X Y Z 9
# = next char for double of same button

I came across a problem where I wanted the same letter twice or 2 letters for the same button so I programed the # key to move to the next char in the message.

* is left empty for future use. It could be setup to test the message against a alphanumeric password

The Char can easily be changed. I copied a old mobile for the key placement but there is properly a more efficient arrangement. 

I used a for statement to print out the chars. I have added comments to show my workings.
 
 Please feel free to add comment to the box below if you have any questions.