Go Down

Topic: MENWIZ: yet another character lcd menu wizard library (Read 110337 times) previous topic - next topic


Copied all .h and .cpp files in the I2c lib and got rid of the LCD.H problem.

Now still have this and more errors to come...........
Never to old to learn and I learn every day


Apr 14, 2012, 12:23 pm Last Edit: Apr 14, 2012, 12:27 pm by brunialti Reason: 1
I see. The New LiquidCrystal library is uncorrectly installed.
You have to cleanup at first:
- delete current LiquidCrystal_I2C,LiquidCrystal and LCD directories
- open the zip file MENWIZ_0_3_0.zip you find in github or in the last file attached to my post

and then install new LiquidCrystal and button libraries:
- drag and drop into /Arduino-1.0/libraries directory the two directories LiquidCrystal_I2C and Buttons you find inside the zip file (LCD is not an independent lib, it is part of the New LiquidCrystal lib)
After that you should see something similar to the two attache images.

You can try the new library running the Hello World example. If it works you can start with MENWIZ ...

Hope it helps


Apr 14, 2012, 12:51 pm Last Edit: Apr 14, 2012, 01:26 pm by brunialti Reason: 1
Sorry. My last answer was to your post #59
This is the anwer to #60

You are using the old version of MENWIZ. Please use the latest, as it is based on New LiquindCrystal lib and has a differente lcd initialization.
After installing the libraries get the latest example.
As you can see the initialization of the LCD is different

Code: [Select]

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>

#define UP_BOTTON_PIN       9
#define DOWN_BOTTON_PIN     10
#define LEFT_BOTTON_PIN     7
#define RIGHT_BOTTON_PIN    8
#define ESCAPE_BOTTON_PIN   11

//Create global object menu and lcd
menwiz menu;
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity

The code
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

works for my LCD (that has 0x27 I2C address). You need to put the I2C address of your actual LCD and the pins your LCD is using (the above pins could be ok for you, but I can't check) .The number 3 is the backligth pin.

If you see previous posts on this thread, I had the same problem with that library, but fm (author of the library) helped me a lot.

I'm using the lib by fm because it is much faster than the "original" and it supports lot of different lcd interfaces. So, should you get an lcd by different providers, it is likely to work properly.
This lib could become the new standard lib for Arduino.

I believe the time spent on it is extremely well done.


Apr 14, 2012, 03:50 pm Last Edit: Apr 14, 2012, 03:53 pm by backbone Reason: 1
No need for sorry... :)

My display worked with original I2C lib.
I think it uses LiquidCrystal_I2C lcd(0x27,20,4); as this was used in the original I2Csample
No idea what pin numbers are used.

At the rear of the display the I2C board is connected.
It has a bridge connector to light the backlight fixed and that is what I use.
So far no need to switch if ON or OFF by software.
So this connector is placed.

When your ideas are placed in the sketch and compiled I get no error.
But after reset the display is empty and the back light is flashing when the LED connector is placed.
It should be so easy...................;-)

I2c sample does not work either.

Never to old to learn and I learn every day


Apr 14, 2012, 04:56 pm Last Edit: Apr 15, 2012, 09:40 am by brunialti Reason: 1
You have the same LCD I tested. So it *must* work  :)

Brute force approach
Here attached you can find the libraries directory I'm using under Arduino-1.0 IDE.
Delete MENWIZ directories everywhere. Backup your current libraries directory. Delete it. Drag and drop libraries directory from the attached zip file.

Test it with the following code

Code: [Select]

#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>

#define UP_BOTTON_PIN       9
#define DOWN_BOTTON_PIN     10
#define LEFT_BOTTON_PIN     7
#define RIGHT_BOTTON_PIN    8
#define ESCAPE_BOTTON_PIN   11

//Create global object menu and lcd
menwiz menu;
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // Addr, En, Rw, Rs, d4, d5, d6, d7, backlighpin, polarity

//instantiate global variables to bind to menu
int tp=0;
int  gp=26;
boolean wr=0;

void setup(){
 _menu *r,*s1,*s2;
 _var *v;
 int  mem;

 // have a look on memory before menu creation
 // inizialize the menu object (20 colums x 4 rows)

 //create the menu tree
 r=menu.addMenu(MW_ROOT,NULL,"MAIN MENU");           //create a root menu at first (required)
   s1=menu.addMenu(MW_SUBMENU,r,"MEASURE SUBMENU");  //add a submenu node to the root menu
     s2=menu.addMenu(MW_VAR,s1,"Choose T scale");    //add a terminal node in the menu tree (that is "variable");
         s2->addVar(MW_LIST,&tp);                    //create the terminal node variable of type OPTION LIST and bind it to the app variable "tp"
         s2->addItem(MW_LIST,"C°");             //add an option to the OPTION LIST
         s2->addItem(MW_LIST,"F°");           //add an other option to the OPTION LIST
         s2->addItem(MW_LIST,"Raw data");     //add the third and last option to the OPTION LIST
     s2=menu.addMenu(MW_VAR,s1,"Set T1 trigger");
     s2=menu.addMenu(MW_VAR,s1,"Enable heater");

 //(optional) create a splash screen with some usefull infos
 //the character # marks end of line (WARNING: this could be changed in the next releases)
 //(tip): use preallocated internal menu.sbuf buffer to save memory space!
 sprintf(menu.sbuf,"MENWIZ TEST V %s\n.Free mem. :%d\n.Used mem  :%d\n.Lap secs  :%d",menu.getVer(),menu.freeRam(),mem-menu.freeRam(),5);
 menu.addSplash((char *) menu.sbuf, 5000);

 //declare navigation buttons (required)
 // equivalent shorter call: menu.navButtons(9,10,7,8,11,12);

 //create a user define screen callback to activate after 7 secs since last button push

void loop(){

// user defined default screen
void msc(){
 sprintf(menu.sbuf,"User screen\nUptime (s): %ld\nFree mem  : %d\n\n",millis()/1000,(int)menu.freeRam());

Let me know


Apr 14, 2012, 10:54 pm Last Edit: Apr 15, 2012, 01:17 am by fm Reason: 1
What I see, is that the part number on the LCD backpack is a PCF8574. For that ASIC the I2C address should be in the range of 0x38. It depends also on how they've configured the address lines on it.

If that is not the correct value try in the following range: (0x38 - 0x3F). You will need to look at their datasheet.


As in post #63, if I understood correctly, it seems that the lcd at certain point worked, so I suggest also to use that address...


Never to old to learn and I learn every day


I'm considering to add a variable pinpointing method, that is: use EEPROM library to save actual values of the user defined variables in order to let settings be available even after an arduino restart.
It is not very clear to me if the 1024 bytes available on at328 are the same used by F() metafunction.
In this case I have to hand off or consider different implementation ways.

By the way ... floating points variables are now implemented and will be available on next prerelease.


Wow, long thread!

fm, brunialti, olikraus, just to side track this thread once more, I've done some improvement to my library and now it has these neat features. By no means can I support newbies with these features that can't even be turned into generic library function calls but to more experienced people trying to make money with their products, these features add values. Hope I can use fund I get from professional help to support the free end of my library (actually all library function calls are free to use but how you use them to make advanced features are not yet open).


I'll be adding more features including variable length of list (say you adjust one parameter and the list expands to show its details).


Liudr, I saw the video. Impressive.

My goal with MENWIZ is to return some to the community. I've got lot of support from the social and as far as I can I would like to give back my contribute. I have some ideas about new clever functionalities and cleaner code and architecture. If I had time I would even like to write a code generator.But I do'nt know if there are interested candidate users. With a little bit more powerfull platform I would be able to do really interesting things...

The point you arise about the balance between free and charged efforts is also a good point. I think it is easier on the hw side.
On my side (sw) i see very difficult to get money from. By now I'm surprised how short has been the learning curve in Arduino. Of course I've been helped by long programming experience.

Anyway, untill i'll get fun i'll develop menwiz and other libs... This is not o promise , it is a menace ... :)


Great! I maintain half a dozen arduino libraries and this one (phi_prompt) gets most attention since it has practical use in products. I'm trying to support the beginners with simple function calls that needs not much programming skills. I'm also helping intermediate users with standard function calls. But I can't support advanced features freely since that would be too much work especially when someone "that doesn't know which end of the equal sign does what" wants fancy features with the advanced features but is not in the right coding skill level to do it.


Apr 19, 2012, 10:57 pm Last Edit: Apr 22, 2012, 09:50 pm by brunialti Reason: 1
I posted the version 0.4.0 at github.com/brunialti/MENWIZ and here attached
Added support for float and byte variable data types.
Feedback are welcome.


I've just tried the menwiz library and I'm totally satisfied  :)
clean, concise code, support for New LiquidCrystalLibrary, plus it's easily hackable if you want to insert your own input routines (just replace the code of menwiz::scanNavButtons() with your own, in the .cpp file)

I have one question though: I see that the examples take about 16K of flash. Could this be lowered? For example, I'm using a 595 3-wire LCD so I suppose I don't need to include the Wire.h library(?). But when I don't include it I get an error. In general, could I further squeeze menwiz's footprint?


Jun 11, 2012, 05:23 pm Last Edit: Jun 11, 2012, 05:25 pm by brunialti Reason: 1
I'm happy it can be usefull for you.
Wire is not directly required by menwiz but isi called by LiquidCrystalLibrary (at least on the I2c version). I did'nt test with a 3wire lcd so i'm not 100% sure. The wire include is called not only by the sketch but also by MENWIZ.h. I frankly do'nt know if it is required by LiquidCrystalLibrary LCD.h (the virtualized lcd managemnt layer) inlcude.
I implemented a menwiz version using flash memory for menu item strings. it save some precious sram. About flash ram: I unfortunately do not think the total amount is significantly squeezable , due to the coding approach (preallocated objects vectors). I could save some memory with a more aggressive dynamic allocation, but it could increase small sketches (sketches with small menu structures) footprint due to the added pointer tables.
You can carefully tweak the following values inMENWIZ.h, provided you understand exactly what they mean (use menwiz::getErrorMessage while debugging)

Code: [Select]

// ---------------------------------------------------------------------------

#define MAX_MENU       15   //maximum number of nodes (absolute supported max number of addMenu calls)
#define MAX_OPTXMENU   5    //maximum number of options/submenus for each node (max number of addItem call for each menu item)
#define MAX_BUFFER     84   //dimension=columns x rows + rows. CHANGE IT IF LCD IS BIGGER/SMALLER THAN 4X20 CHARS

The footprint in Leonardo board shoud be even worse: as it manage USB/serial directly you must add 4k more (but that is true for all sketches ...)

By the way I'm currently trying to network integrate a raspberrypi with arduino, using mqtt protocol. I can assure that arduino is *really* simple to use ....  :-)

Go Up