M2TKLIB Hello World with LiquidCrystal_I2C

olikraus:
I added the New LiquidCrystal Library (https://bitbucket.org/fmalpartida/new-liquidcrystal/) as output engine to M2tklib.
A first beta release for the New LiquidCrystal Library is available for download: Google Code Archive - Long-term storage for Google Code Project Hosting.

Oliver

Thanks. I just downloaded it and am trying to understand how to make the Hello World example work with my I2C display. Firstly I had to include Wire.h to get it to compile.

Then I tried to convert it to I2C by including the different library and changing how the lcd object was created (and changing the setup to 20x4 from 16x2)

#include <Wire.h> 
//#include <LiquidCrystal.h>
#include <LiquidCrystal_I2C.h>
#include "M2tk.h"
#include "utility/m2ghnlc.h"


LiquidCrystal_I2C lcd(0x3F);

M2_LABEL(hello_world_label, NULL, "Hello World!");
M2tk m2(&hello_world_label, NULL, NULL, m2_gh_nlc);

void setup() {
  m2_SetNewLiquidCrystal(&lcd, 20, 4);
}

void loop() {
  m2.draw();
  delay(500);
}

This is producing these errors

In file included from HelloWorld.pde:42:
/home/myhome/sketchbook/libraries/M2tklib/utility/m2ghnlc.h:32: error: variable or field ‘m2_SetNewLiquidCrystal’ declared void
/home/myhome/sketchbook/libraries/M2tklib/utility/m2ghnlc.h:32: error: ‘LCD’ was not declared in this scope
/home/myhome/sketchbook/libraries/M2tklib/utility/m2ghnlc.h:32: error: ‘lc_ptr’ was not declared in this scope
/home/myhome/sketchbook/libraries/M2tklib/utility/m2ghnlc.h:32: error: expected primary-expression before ‘cols’
/home/myhome/sketchbook/libraries/M2tklib/utility/m2ghnlc.h:32: error: expected primary-expression before ‘rows’
HelloWorld:45: error: no matching function for call to ‘LiquidCrystal_I2C::LiquidCrystal_I2C(int)’
/home/myhome/sketchbook/libraries/LiquidCrystal_I2C/LiquidCrystal_I2C.h:57: note: candidates are: LiquidCrystal_I2C::LiquidCrystal_I2C(uint8_t, uint8_t, uint8_t)
/home/myhome/sketchbook/libraries/LiquidCrystal_I2C/LiquidCrystal_I2C.h:55: note: LiquidCrystal_I2C::LiquidCrystal_I2C(const LiquidCrystal_I2C&)
HelloWorld.pde: In function ‘void setup()’:
HelloWorld:51: error: ‘m2_SetNewLiquidCrystal’ was not declared in this scope

So assuming I just don't understand :slight_smile: I thought it was time to ask advice.