VKey Voltage Keypad Hookup Guide

This Tutorial is Retired!

This tutorial covers concepts or technologies that are no longer current. It's still here for you to read and enjoy, but may not be as useful as our newest tutorials.

Pages
Contributors: Byron J.
Favorited Favorite 3

Arduino Library

To make interfacing the VKey as simple as possible, we've written an Arduino library and example sketch. If you need a refresher on how to install an Arduino library, please see our library tutorial.

The VKey library provides an object that interfaces with a VKey keypad. In a typical application, this class is instantiated as a global object before the setup() function. In the VKey object declaration, you need to select the appropriate analog input pin, and set the power indication to the proper voltage, either THREE (actually shorthand for the more common 3.3V) or FIVE.

It is possible to attach several VKeys, each on it's own analog input pin, by declaring multiple VKey objects to watch the corresponding analog pin numbers.

The VKey status is queried using the function

bool CheckKeys(eKeynum & k);

The function will always return an indication of the current button in reference parameter k, or NONE in the case that no buttons are pressed. The function also returns a boolean indication of whether the key has changed since the last time it was queried -- a form of edge detection. Many applications will only care about handling the key number when it updates, and don't need to process the input when it is unchanging.

The next page will show us a quick sample sketch that uses the VKey library.