Article updated at 28 Oct 2017
Subscribe for this article updates
A matrix keyboard can be used as an input device in different applications.
- Keypad in handheld devices.
- Access control systems, for keying in ID number and password, etc.
- Low-end point of sale terminals which are not equipped with touch screen interface.
- and many more..
This tutorial demonstrates how to interface 4x4 matrix keypad with Toradex module & Iris Carrier Board V1.1 A.
Image of keypad used:
- Download demo code from the Download Section.
- Build and deploy the application.
- Navigate to My Device > Program Files > matrixkeypad_demo and run the application matrixkeypad_demo.exe.
- Demo application can be downloaded from the Download Section.
- Navigate to Solution Explorer in visual studio > Right Click on Solution > Properties > Devices.
- Uncheck "Deploy the Latest version of the .NET Compact Framework (including Service Packs)".
- Build and deploy the application on your WinCE device.
- Download and Install .NET Compact Framework directly to the FlashDisk of the device from here.
- Go to My Device > Program Files > vcsharp_matrixKeypad_demo and run the application vcsharp_matrixKeypad_demo.exe.
Following GUI will open. Press Start Scanning button to start the scanning. A box on output window will glow with green color on pressing respective button on matrix keypad as shown below.
Note: For better results, keybd_event function can be used to keep the current status of the keys and synthesizes a keystroke. It may be useful to implement debouncing and to generate actual key strokes, allowing the matrix keyboard to behave like a regular one. This will also support auto-repeat and other typical keyboard behaviours. For more information, check this MSDN article.