Pages: 1 ... 3 4 [5] 6 7 ... 34   Go Down
Author Topic: MENWIZ: yet another character lcd menu wizard library  (Read 75848 times)
0 Members and 1 Guest are viewing this topic.
The Netherlands
Offline Offline
Sr. Member
****
Karma: 4
Posts: 333
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...........


* 04.jpg (167.6 KB, 1280x1024 - viewed 22 times.)
Logged

Never to old to learn and I learn every day

rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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



* s1.gif (91.45 KB, 467x708 - viewed 29 times.)

* s2.gif (92.54 KB, 467x708 - viewed 25 times.)
« Last Edit: April 14, 2012, 05:27:11 am by brunialti » Logged

rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
//MENWIZ ESAMPLE
#include <Wire.h>
//INSERT ALL THE FOLLOWING 4 INCLUDES AFTER INCLUDING WIRE LIB
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>

// DEFINE ARDUINO PINS FOR THE NAVIGATION BUTTONS
#define UP_BOTTON_PIN       9
#define DOWN_BOTTON_PIN     10
#define LEFT_BOTTON_PIN     7
#define RIGHT_BOTTON_PIN    8
#define CONFIRM_BOTTON_PIN  12
#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.

 
« Last Edit: April 14, 2012, 06:26:31 am by brunialti » Logged

The Netherlands
Offline Offline
Sr. Member
****
Karma: 4
Posts: 333
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No need for sorry... smiley

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.

Paco


* IMG_0547.jpg (158.76 KB, 800x533 - viewed 34 times.)
« Last Edit: April 14, 2012, 08:53:23 am by backbone » Logged

Never to old to learn and I learn every day

rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You have the same LCD I tested. So it *must* work  smiley

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:
//MENWIZ ESAMPLE
#include <Wire.h>
//INSERT ALL THE FOLLOWING 4 INCLUDES AFTER INCLUDING WIRE LIB
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>

// DEFINE ARDUINO PINS FOR THE NAVIGATION BUTTONS
#define UP_BOTTON_PIN       9
#define DOWN_BOTTON_PIN     10
#define LEFT_BOTTON_PIN     7
#define RIGHT_BOTTON_PIN    8
#define CONFIRM_BOTTON_PIN  12
#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;

  Serial.begin(19200);  
  
  // have a look on memory before menu creation
  Serial.println(sizeof(menwiz));
  mem=menu.freeRam();
  
  // inizialize the menu object (20 colums x 4 rows)
  menu.begin(&lcd,20,4);

  //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"
          menu.getErrorMessage(true);
          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->addVar(MW_AUTO_INT,&gp,10,100,2);
      s2=menu.addMenu(MW_VAR,s1,"Enable heater");
          s2->addVar(MW_BOOLEAN,&wr);

  //(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);
  menu.navButtons(UP_BOTTON_PIN,DOWN_BOTTON_PIN,LEFT_BOTTON_PIN,RIGHT_BOTTON_PIN,ESCAPE_BOTTON_PIN,CONFIRM_BOTTON_PIN);

  //create a user define screen callback to activate after 7 secs since last button push
  menu.addUsrScreen(msc,7000);
  }

void loop(){
  // NAVIGATION & DRAWING MANAGEMENT
  menu.draw();
  //PUT APPLICATION CODE HERE
  }

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


Let me know

* libraries.zip (3606.62 KB - downloaded 4 times.)
« Last Edit: April 15, 2012, 02:40:17 am by brunialti » Logged

Málaga, Spain
Offline Offline
Edison Member
*
Karma: 41
Posts: 2182
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: April 14, 2012, 06:17:37 pm by fm » Logged

   

rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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...
Logged

The Netherlands
Offline Offline
Sr. Member
****
Karma: 4
Posts: 333
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for your assistance.

This works.

Paco
Logged

Never to old to learn and I learn every day

rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Central MN, USA
Online Online
Tesla Member
***
Karma: 75
Posts: 7260
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).

http://arduino.cc/forum/index.php/topic,101503.0.html

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


rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 ... smiley

Logged

Central MN, USA
Online Online
Tesla Member
***
Karma: 75
Posts: 7260
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

* MENWIZ_0_4_2.zip (517.31 KB - downloaded 3 times.)
« Last Edit: April 22, 2012, 02:50:12 pm by brunialti » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I've just tried the menwiz library and I'm totally satisfied  smiley
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?
Logged

rome
Offline Offline
Sr. Member
****
Karma: 17
Posts: 487
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
// DIMENSIONS (DIMENSIONAL LIMITS OF STATICALLY ALLOCATED STRUCTURES)
// ---------------------------------------------------------------------------

#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 ....  :-)
« Last Edit: June 11, 2012, 10:25:30 am by brunialti » Logged

Pages: 1 ... 3 4 [5] 6 7 ... 34   Go Up
Jump to: