Hi Bruno, thanks for your reply.
It looks like the LCDI2C2 lib differs from the Liquidcrystal_I2c lib only in the begin and setBacklight and contrast routines
Here is my changes to your Test_all_variables example that I tried to use the LCDI2C2w lib
//MENWIZ ESAMPLE
#include <Wire.h>
#include <LCDI2Cw.h>
//INSERT ALL THE FOLLOWING 5 INCLUDES AFTER INCLUDING WIRE LIB
//#include <LCD.h>
//#include <LiquidCrystal_I2C.h>
#include <buttons.h>
#include <MENWIZ.h>
//#include <EEPROM.h> // to be included only if defined EEPROM_SUPPORT
// DEFINE ARDUINO PINS FOR THE NAVIGATION BUTTONS
#define UP_BUTTON_PIN 9
#define DOWN_BUTTON_PIN 10
#define LEFT_BUTTON_PIN 7
#define RIGHT_BUTTON_PIN 8
#define CONFIRM_BUTTON_PIN 12
#define ESCAPE_BUTTON_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
unsigned char i2cAddress = 0x4C; // LCD module I2C address
const int myrows = 2;
const int mycols = 16;
// initialize the library with the number of columns and rows
LCDI2Cw lcd(mycols, myrows, i2cAddress);
//instantiate global variables to bind to menu
int tp=0;
float f=26.0;
boolean bb=0;
byte b=50;
void setup(){
_menu *r,*s1,*s2;
_var *v;
int mem;
Serial.begin(9600);
// 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,mycols,myrows);
Here are my changes to Menuwiz.h
#ifndef MENWIZ_h
#define MENWIZ_h
//#define EEPROM_SUPPORT //uncomment if you want to use the readEeprom and writeEeprom methods!
#include <Wire.h>
//#include <LCD.h>
//#include <LiquidCrystal_I2C.h>
#include <buttons.h>
Here are my changes to Menuwiz.cpp
void menwiz::begin(void *l,int c, int r){
ERROR(0);
tm_start=millis();
row=r;
col=c;
flags=0;
lcd=(LCD*)l;
// for liquidcrystal_i2c
//lcd->begin(c,r); // LCD size
//lcd->setBacklight(HIGH);
// end for liquidcrystal_i2c
// for LCDI2Cw // gives error: MENWIZ.h:196: error: ISO C++ forbids declaration of 'LCD' with no type
lcd->begin();
lcd->backlight(200);
lcd->contrast(50);
// end for LCDI2Cw
// for both
lcd->noCursor();
lcd->createChar(0,(uint8_t*)c0);
// end for both
sbuf=(char*)malloc(rc+r); if(sbuf==NULL) ERROR(900);
buf =(char)malloc(2*c); if(buf==NULL) ERROR(900);
}
With these changes i get the following compile time errors:
E:\arduino-1.0.1\libraries\MENWIZ/MENWIZ.h:198: error: ISO C++ forbids declaration of 'LCD' with no type
E:\arduino-1.0.1\libraries\MENWIZ/MENWIZ.h:198: error: expected ';' before '*' token
The LCDI2cw lib backlight routine takes a value from 0 to 255
The LCDI2Cw lib contrast routine takes a value from 0 to 100
and the LCDI2Cw lib begin routine takes no parameters and only issues a Wire.begin() command and a lcd.clear command.
Can you suggest what I can try to clear the forbids declaration of 'LCD' with no type error?
I can email you the LCDI2Cw library files if you would like. I just need your email or another way to send you the files.
I have many sketches that use this LCDI2Cw lib and would like to continue to use it with your menu system.
Thanks
Tom