Welcome to the Phi-menu page!
After thousands lines of code and 25 pages of documentation, I eventually decided to make my first and last release of this package. Its replacement is the phi_prompt, packaged nicely in a library.
Make an interactive program on Arduino with ease!
Open-source software for Arduino and Phi shields.
This following is what your project will look like with the phi-menu. I spend very little time with the interactive menu but concentrated on my actual project, since the phi-menu system takes over all the work. The details of this project is in the example section.
The phi-menu is an LCD keypad interactive software. It provides a light-weight template for programming the multi-function Phi shields. It provides three different types of customizable LCD menus (see picture at the beginning) together with functions using the LCD and keypad to collect user inputs such as strings, numbers, Y/N, month, day of the week, time, even Morse code. You can easily develop your own interactive project on Arduino and Phi shields without having to deal with the hassle to either hodgepodge codes from various online authors or write the codes yourself the hard way. From the very start, your project looks like a million dollars.
2. Documentation and download
Here is the documentation updated on 03/12/2011. It contains all details of the structure of the software and its functions with one example, making a car reverse obstacle sensor, featured on instructables.com
3. Detailed step-by-step example
This is an example that displays “animation” on a character LCD. We want to make an regular character LCD display an couple of animated arrows.
We need three menu items:
1. Display the animated arts
2. Set parameters, such as speed of the animation, forward or backward, and which animation to play
3. Display credits.
First, take a quick look at the FUNCTIONS.pde
Then add your menu texts in the menu_item00 and menu_item01 strings (in red) and add more menu items as you need (in green) . Make sure you enumerate all these strings in the later array (in green).
Now define some variables that you will be using in your program here after the comment line (in green).
Scroll down in FUNCTIONS.pde and find the switch command. Make sure you add additional menu items in the function (in green).
We code the parameters function first. We have three parameters, delays, art_number, and _forward. In parameters function (menu_function_0), we need to ask user to adjust each parameter at a time. You first prompt the user with a string such as “Delays” (in red) so the user knows what he is adjusting. Then you assign the value of the parameter, such as “delays”, to a temporary variable para_val (in purple). This way if the user changes the value and decides to escape, the original value of delays is not disturbed. Then invoke the hmi function. It handles everything, displays the current value of the parameter, sets the up and down keys to change the value, with lower and upper limits, and step size per key press. Once the user is happy with the value, it returns. Details of how to use the hmi function is in the documentation.
The last line in the block updates the parameter only if the user presses confirm. If the user actually escapes, the parameter is not changed.
In the body of the FUNCTIONS.pde, you will define menu_function_1. such as the following image:
In the body of the FUNCTIONS.pde, you will define menu_function_2. such as the following image:
4. More examples
- Animated characters on LCD You have a few animated arrows and adjust speed and direction of animation. Full code, nutshell
- Password input panel You demand password from the user before you show them top secrets! Full code, nutshell
5. Future improvements
I plan to improve the phi-menu in the following areas:
- Turn the codes into class and encapsulate all variables and functions
- Add multiline message stroll display function support to display longer messages on a 16*2 or larger character display.
- Port the code to work on KS0108-compatible 128*64 dot matrix displays
- Add btn_null and update buttons class to define null button. It will do nothing and stays off. This saves one from deleting buttons objects and sensing codes to free the pin that is shared with a button.
6. The legal stuff
Let’s keep this short. The software is defined as any part of the complete collection of the code of the phi-menu system. There is no explicit or implicit warranty that the software will work. You are free to modify and redistribute the software as long as the credit section is kept. You can add your own credit and modify the summary of the functions.
You are not allowed to use the software for commercial purposes, which include but not limited to selling the software or its modified versions for money directly or selling hardware with the software attached for “free”. The software is meant to be shared among interested individuals and educational institutions.
If you like to use the software with your products, commercial licenses can be obtained by contacting the author at https://liudr.wordpress.com