Phi_interfaces library home page
This phi_interfaces library unites all input devices in an unprecedented way. You can sense a matrix keypad the same way as push buttons, rotary encoders, or analog buttons, or serial keypads, or simulate key presses on arduino serial monitor or even use your smart phone to generate key presses to control your arduino projects. You could create multiple operating interfaces, one on arduino project, one on a remote server and one on your smartphone. You can then control your project wirelessly from meters away or from world away and it feels like you’re controlling it right on your desk.
What is more exciting is that you don’t need to make any change on your code to do all the above. Start your project with a few push buttons and later decide to control your project on your smartphone with bluetooth serial, and finally settle for dual interface, with keypad on the project and with smartphone using bluetooth serial. No need to change any code while you are making all these hardware changes. Interfaces should be just like that, snap on and snap off, all with standard plugs and no fuss.
I will be using this as the physical layer for my phi_prompt user interface library soon.
Library, sample code and documentation download:
At the moment, I have placed the download on my phi_prompt google code page. Soon I will create a separate google code page just for phi_interfaces. The library, including sample codes and full documentation (in color LOL) are here:
Here is the class hierarchy:
I will be posting videos and tutorials soon!
Jan 2 2012:
As some of you may know, I have developed several arduino open-source libraries, phi_buttons, phi_prompt, phi_big_font,phi_morse, phi_super_font, etc.
My main focus is to interface arduino with inputs such as buttons, keypads, etc. and outputs such as LCDs so a project developer doesn’t have to through all the trouble to create these themselves. I’ve been successful with these libraries so far but I’m not completely satisfied with how contributed libraries are maintained.
The reason I developed these codes is that the current status of contributed libraries is that each library is managed by an individual and in order to say use a matrix keypad and a couple of rotary encoders, you need at least two libraries and they follow different conventions and you are expected to learn different things with each new library you come across. And most of them don’t even support hold-and-repeat! Not to mention lots of them are no longer maintained and are left to rot. There has to be some common basis among some of the libraries so a general expectations are met, such as each keypad library should have a getKey for getting a key press regardless who wrote the library, through inheriting from a common interface.
Here is what I’ve just done in the past few weeks, using what I already had as basis:
I’ve made a new library called phi_interfaces library. At the moment it contains classes such as single buttons, matrix keypads, analog buttons (essentially a keypad in nature), rotary encoders, and liudr keypad, plus some nice things shared by these classes.
To write a project, you just need to include one library, the phi_interfaces.h, and you can create objects such as single buttons, matrix keypads, rotary encoders etc and they all behave as expected.
The matrix keypads, analog buttons (keypad in nature), rotary encoders, and liudr keypads (or any other future keypads) are all inheriting from multiple_button_input, which has a function called getKey, same as the popular keypads library. Any of these objects can provide buttons pressed with this function. They all support hold-and-repeat and essentially can support my multi-tap codes if they have at least 10 number keys. If you are interested in expanding this interface to a different type of keypad, say a capacitive keypad, all you have to do is to write a sense_all() code to provide the interface a handle to sense all possible buttons and give an immediate status. All the debouncing and status changes are handled by interface functions and eventually by the getKey. So even a library developer will save time by not having to write their own debouncing etc. while we can all contribute to the polishing of these basic codes.
This also makes my library expansion much easier.
The buttons class is a subclass of the single_button_input class (interface). The interface has a few functions, sense() being the most useful function. Any classes using this interface will need to implement this function so they can be controlled the same way.
Future development will support IR remote, PS/2 keyboard, etc under the multiple_button_input, which will all support the getKey method.
Using phi_prompt or phi_interfaces library in commercial products:
The libraries are free for personal use. If you want to integrate the libraries in a product that you will sell for money, please obtain a license for $30, which covers the current and all future updates of both libraries. This purchase grants you license to both phi_prompt and phi_interfaces libraries. Additional programming assistance can also be purchased at inmojo.com store but please contact me first regarding the type of programming help you need before purchasing.