Phi_prompt and Phi_buttons released - interaction with LCD and buttons

After some extensive work and revision from my original phi-menu idea (several K lines of code and 25 pages doc), I have been able to release the following two libraries to the public:

Phi_prompt: a library UI (user interface) functions for character LCD and push buttons. It should be easy to adapt to dot matrix LCD and keypads if necessary. If enough interests are shown from users, I can consider buying a keypad and do some footwork.

The library provides three essential functions with support functions that you can use as well:

input_integer asks the user to enter an integer with lower and upper bounds, step size, location to display the number and wraps around if you go beyond upper bound. See line 3 and 4 on the image.

select_list asks the user to select an item from a list, which is stored in PROGMEM. There are many rendering options such as 2 by 2 (line 5 and 6 on image), or classic list with index (line 1 and 2 o image, AKA an nice menu).
select_list is versatile enough and is often used to render menu of infinite levels. You can also use a list of YES and NOW, or HIGH and LOW or MON, TUE, ... for your input.

input_panel asks the user to enter arbitrary characters between lower and upper. You can decide to restrict to 0-9, A-A, a-z, or any range of characters, with the option to include 0-9 in the range such as the example on line 7 and 8 on image. Any characters not included in the range will not change as a convenience feature (such as the dot in the file name will not change since my input range was set to 0-9 and A-Z).

Other functions include wait_on_escape, a functions that polls all buttons for any key press, msg_lcd, a function that renders PROGMEM strings on lcd, or else.

Here is the blog post, which includes the source code release (20110327), three simple examples and one extensive example with a two-level menu, pretending itself as an interactive data logger.

Next, the phi_buttons class library:

This is a simple button library with all the simple features with a twist, there are two virtual buttons, auto button, that automatically presses at a defined frequency (for automatically scrolling through a list or number), and a null button, which acts as nothing, a feature that eases program changes. If you have used 6 buttons in one project and want to save two buttons for a new project, you just define the two buttons as null buttons and don't have to dig into your codes and delete everywhere you see those two buttons.

Here is the blog post, which includes the source code release (20110327), some code snippets and one example, which reports the button pressed to serial port.

Videos are up:

playlist:

http://www.youtube.com/view_play_list?p=B983E9145E4348FA

Hi Dr. Liu,

thanks a lot for your Phi-Prompt library, it works like a charm!

I adapted it to use the NewSoftSerial.h library instead of LiquidCrystal, because my display uses a serial connection. It's really just a hack (and not the prettiest) but if you are interested I'd of course share my findings! (which I'll propably do anyway to help other users)

Keep up the great work,
Keija

(I hope it's okay, that i used this Thread, otherwise - let me know!)

Keija,

You are very welcome! I am considering setting up a google code page for this project and your variation is definitely welcome as part of the code repository. Please let me know when you release the code. Since I will be releasing a new version of the library (calling conventions are unchanged but more functions are added), it would be very helpful to describe what you did to modify my original code to work on a serial LCD when you release your codes.

Hi Liu,

great! I think i should be able to put it up tomorrow - as i said it's very much of a hack at the moment, but i'll try to modify it in a way, that you'll only need to change the liquid chrystal library and only make minor changes to the rest ( as an example: at the moment you'd have to replace lcd->clear(); with clear(); everywhere it occurs).

I'll prepare a rough Tutorial for tomorrow and will try to improve it - I already have a few ideas :slight_smile:
Keija

Great! The more clear you hack it the easier other can use this hack. It will be listed as one of the standard hacks :slight_smile: the other being shift register driven LCD hack falconfour did a while back.

Hi Liu,

I've created a walk through of all the steps necessary and added it as a .pdf to this post. As mentioned in the Document, i'll try to avoid steps 2 and 3 by programming a wrapper class, but i haven't found time to do this. If you have any suggestions, or tutorials i'd be thankful :slight_smile:

thanks again for your phi_prompt library.

greetings,
Keija

edit:
I just noticed, that the file is not available, if you're not a registered member - I will upload it to a different server, to make it available to everyone :slight_smile:

Modify_Phi_prompt_NewSoftSerial.pdf (18.3 KB)

Awesome! I will download this to my folder and keep it as a standard hack. Now just have to prep for optics lecture in one hour. I'll scare some students with new concepts this time.

OK. I've put my phi_prompt library on google code. Stilling learning how to use google code.

http://code.google.com/p/phi-prompt-user-interface-library/

Hi Liu,

thanks for featuring me :slight_smile: I Hope your students made it through the lesson :wink:

Keep up the good work,
Keija

Hi,

I recently updated the instructions to reflect the changes brought by arduino 1.0
The pdf now features Instructions for Arduino 0022 and Arduino 1.0 :slight_smile:

Keija

Modify_Phi_prompt_SoftwareSerial.pdf (212 KB)

Thanks Keija!

Just posted on the google code page! I'll have to try out arduino 1.0 myself and enjoy the hack.

hi luidr,

I am trying to implement your phi_prompt library and wanted to use a serial LCD. After some frustrating hours I found this hack from Keija, which is exactly what i wanted (sparkfun serial LCD 4x20), but after the modifications I only get the error:
error: 'class SoftwareSerial' has no member named 'clear' (the same for the other added classes)

I understand the serial libraries (aka serLCD or similar) for communication with the display and did exactly what was described in the pdf, but no luck so far...

any sugestions are apreciated

badmiton1

You are trying to clear the serLCD with clear() but you should use the clear() on the serLCD object (if there is such object from a library), not on the software serial port object. I didn't do the modification so I don't know what was done. Are you using a serLCD library? If yes, post a link.