Go Down

Topic: M2TKLIB Hello World with LiquidCrystal_I2C (Read 4 times) previous topic - next topic

olikraus

Quote

I worked with fm to ensure that the library is transparently compatible with the original LiquidCrystal library.

Ah, this explains why it had been that easy to port the existing procedures to New LiquidCrystal lib.

I was requested by several users to support I2C for m2tklib character displays, but i do not plan to support any further libs. In fact, you both confirmed me that this lib is flexible enough to support several other types of hardware also.

Oliver

olikraus

Quote
now the M2TKLIB Hello World example works, modified as below.


Thanks for the feedback. Let me know if there are any questions regarding M2tklib.

Oliver

earlboatman


Yes, was just writing this when you posted - now the M2TKLIB Hello World example works, modified as below. Changes are to include <Wire.h>, to include <LiquidCrystal_I2C.h> instead of <LiquidCrystal.h>, and to set it up using "LiquidCrystal_I2C lcd ( 0x3F,2,1,0, 4,5,6,7,3,POSITIVE);"

Code: [Select]
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "M2tk.h"
#include "utility/m2ghnlc.h"

LiquidCrystal_I2C lcd ( 0x3F,2,1,0, 4,5,6,7,3,POSITIVE);

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

void setup() {
 m2_SetNewLiquidCrystal(&lcd, 16, 2);
}

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


Thanks for ALL the help !  



When I try to compile this code I get an error as follows.

Arduino: 1.5.6-r2 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Build options changed, rebuilding all

Using library Wire in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire (legacy)

Using library LiquidCrystal_I2C in folder: C:\Users\KB0NRK\Documents\Arduino\libraries\LiquidCrystal_I2C (legacy)

Using library M2tk in folder: C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk (legacy)



C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=156 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Users\KB0NRK\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\KB0NRK\Documents\Arduino\libraries\M2tk C:\Users\KB0NRK\AppData\Local\Temp\build1579395692306476180.tmp\MenuX2L.cpp -o C:\Users\KB0NRK\AppData\Local\Temp\build1579395692306476180.tmp\MenuX2L.cpp.o

In file included from MenuX2L.ino:4:
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: variable or field 'm2_SetNewLiquidCrystal' declared void
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: 'LCD' was not declared in this scope
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: 'lc_ptr' was not declared in this scope
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: expected primary-expression before 'cols'
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: expected primary-expression before 'rows'
MenuX2L.ino:6: error: 'POSITIVE' was not declared in this scope
MenuX2L.ino: In function 'void setup()':
MenuX2L.ino:12: error: 'm2_SetNewLiquidCrystal' was not declared in this scope

can you help me?

bperrybap

You either have the wrong library or don't have it properly installed.
For that LiquidCrystal_I2C constructor, you need this library:
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home

earlboatman


You either have the wrong library or don't have it properly installed.
For that LiquidCrystal_I2C constructor, you need this library:
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home


I have LiquidCrystal_V1.2.1 installed and use it in other sketches.

If I change the above example with "LiquidCrystal_I2C lcd(0x27, 20, 4);", which works for me it highlights the following line.

m2_SetNewLiquidCrystal(&lcd, 16, 2);

And gives the error -
Arduino: 1.5.6-r2 (Windows 7), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

Build options changed, rebuilding all

Using library Wire in folder: C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire (legacy)

Using library LiquidCrystal_I2C in folder: C:\Users\KB0NRK\Documents\Arduino\libraries\LiquidCrystal_I2C (legacy)

Using library M2tk in folder: C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk (legacy)



C:\Program Files (x86)\Arduino\hardware\tools\avr\bin\avr-g++ -c -g -Os -w -fno-exceptions -ffunction-sections -fdata-sections -MMD -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=156 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega -IC:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\Wire -IC:\Users\KB0NRK\Documents\Arduino\libraries\LiquidCrystal_I2C -IC:\Users\KB0NRK\Documents\Arduino\libraries\M2tk C:\Users\KB0NRK\AppData\Local\Temp\build1579395692306476180.tmp\MenuX2L.cpp -o C:\Users\KB0NRK\AppData\Local\Temp\build1579395692306476180.tmp\MenuX2L.cpp.o

In file included from MenuX2L.ino:4:
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: variable or field 'm2_SetNewLiquidCrystal' declared void
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: 'LCD' was not declared in this scope
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: 'lc_ptr' was not declared in this scope
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: expected primary-expression before 'cols'
C:\Users\KB0NRK\Documents\Arduino\libraries\M2tk/utility/m2ghnlc.h:32: error: expected primary-expression before 'rows'
MenuX2L.ino: In function 'void setup()':
MenuX2L.ino:13: error: 'm2_SetNewLiquidCrystal' was not declared in this scope

As you can see I am new to this and need working codeto learn from.
Thanks Earl

Go Up