Liquidmenu - Menu Library for Liquidicrystal class

Hi everybody.
In attach the library I made for use with LiquidCrystal class.
I think it as very simple and will be happy if someone will try it.

Enjoy

Giuseppe IK0JRE

LiquidMenu.zip (6.97 KB)

In attach new zip file with new example.
For beginners:
LiquidMenu Class is a very simple and enable you to create a menu in LCD with slide cursor up and down. It manages section to fit into LCD lines and move the cursor.

Don't need installation: you must copy into Arduino's libraries directory. Next Arduino's ide restart you should have in "file->Examples" menu, the LiquidMenu item. If you don't see verify the follow library files tree:

/arduino main directory/libraries/LiquidMenu/examples/LiquidMenu

In LiquidMenu directory you must see LiquidMenu.cpp,LiquidMenu.h,keywords.txt ad examples dir. In Examples directory you must see LiquidMenu sketch directory.

All files in .zip
LiquidMenu.cpp (file class)
LiquidMenu.h (class header)
keywords.txt (syntax color keywords)
LiquidMenu.ino (example)

Use of library is very simple and fast(example in library should be very clear):

  1. call class constructor
  2. fill menu descriptor string array (every strig added you get index value))
  3. call initmenu for show first section menu
  4. next you manages UP/DOWN button and on every pression you can call moveCursorMenu method with up/down flag.
  5. at user action you can call getMenuSelected method to get index to selected menu.

I hope you like it.
If you need informations write me.
Enjoy

Giuseppe IK0JRE

LiquidMenu_V0_1.zip (6.9 KB)

In attach new zip file with fix bug in example file.

Giuseppe IK0JRE

LiquidMenu_V01b.zip (6.92 KB)

Hello,
Is it possible to expand the menu structure with submenus and use the same button code?

For example if we select >Test1 by pressing BMIDDLE we enter a sub menu with some choices:

Setup1
Setup2
.....

Lets say in Setup1 we want to set a limit with the buttons:
if (BUP) increase Imax;
if (BDOWN) decrease Imax;
if (BMIDDLE) save setting and return one level up;

Thaks in advance for any assitance!

Before you must define all menu at first level and bind to an appropriate function.
For example the code:

 menuActionPointer[lMenu.addMenuItem("Test1")]=FunTest1;
  menuActionPointer[lMenu.addMenuItem("Test2")]=FunTest2;

sets in menuActionPointer array the function's pointer for menu1 and menu2 to FunTest1 and FunTest2 functions.

In these functions you should develope your code and the second level.

In the second level if you need up and down do other, you must develope your code. For example you can use the follow:

byte readButton(int buttonPin) { 
  if (digitalRead(buttonPin)) 
      return HIGH;                // still high, nothing happened, get out
  else {                          // switch pushed - wait for debounce
      delay(DEBOUNCE_MS);         
      if (digitalRead(buttonPin)) 
          return HIGH;            // false pushed
      else 
          return LOW;             // true pushed
      }
}

Call readButton with button as parameter you want use and do your action.

For the first level you can use default button (up,down and middle) and at second level or create a new instance of class or write a looop to control buttons.