Using I2C module with LCD 16x02

Hello everyone, does anyone know how I can use the i2c module together with a Display LCD 16x02?
Using the arduino IDE was easy, but using mongoose I could not use.
Does anyone know how to print a “Hello Word” using the LCD 16x02 + I2C?
I’m using esp8266
mos call I2C.Scan return 39

 config_schema: 
  - ["i2c.enable", true]
  - ["i2c.sda_gpio", 4]
  - ["i2c.scl_gpio", 5]
  - ["i2c.debug", true]
  - ["debug.level", 3]                                                              

There is a very nice Arduino library which can be easily ported to Mongoose OS.

In the old forum, I found this library for mongoose.

I tested the code in javascript. This is my code.

load("api_aws.js"); //aws
load("api_gcp.js");
load("api_gpio.js");
load("api_timer.js");
load("api_arduino_liquidcrystal_i2c.js");


//ERROR
LiquidCrystalI2C.create(addr, lcdColumns, lcdRows); 
LiquidCrystalI2C.init()
LiquidCrystalI2C.setCursor(0, 1)

let D5 = 14;
let D8 = 15;
// BTN active rele
let BTND7 = 13;
let clicked = false;
GPIO.set_mode(D8, GPIO.MODE_OUTPUT);
let dht = DHT.create(D5, DHT.DHT11);

Timer.set(20000 /* milliseconds */, Timer.REPEAT, function () {
  let t = dht.getTemp();
  let h = dht.getHumidity();

  if (isNaN(h) || isNaN(t)) {
    print('Failed to read data from sensor');
    return;
  }  

  if (t >= 33) {
    if (clicked !== true) { GPIO.write(D8, 0); }
  }
  else {
    if (clicked !== true) { GPIO.write(D8, 1); }
  } 
   //Send AWS
   Shadow.update(0, { reported: { temperature: t, humidity: h } }) 

   //ERROR
  LiquidCrystalI2C.clear( )
  LiquidCrystalI2C.setCursor( 0,0 )
  LiquidCrystalI2C.print("Temp: " );
  LiquidCrystalI2C.print("Temp: " + String(t) + (char)223 + "C" );

}, null);



The problem occurs only with the display.

let lcd = LiquidCrystalI2C.create(addr, lcdColumns, lcdRows);
lcd.init()
lcd.setCursor(0, 1)

The code is not generating the object.
When you run lcd.init () returns this error.

[Oct  5 16:37:17.288] {"__p":{}}  //object incorrect
[Oct  5 16:37:17.880] 
[Oct  5 16:37:17.880] SW WDT @ 0x4000dd38 //error
[Oct  5 16:37:17.880]  A0: 0x40002ef1  A1: 0x3ffff570  A2: 0xc42927fc  A3: 0x00000015
[Oct  5 16:37:17.886]  A4: 0x05056692  A5: 0x3ffee760  A6: 0x0000001f  A7: 0x3ffff5e0
[Oct  5 16:37:17.891]  A8: 0x402adabc  A9: 0x00000000 A10: 0xfffffffe A11: 0x00000000
[Oct  5 16:37:17.897] A12: 0x09896800 A13: 0xbf23c16a A14: 0x3fff47ec A15: 0xfff20000

It worked!!
I found another repository and just changed the mos file to esp8266.

This is the repository.

Although this post is a little old, I just wanted to ask if you could share a code example. I tried the following:

load("api_lcd_i2c.js");
let lcd=LCD_I2C.create(0X3E);
lcd.begin(16,2);
lcd.setCursor(0,1);
lcd.print('Test');

Using this lib. Unfortunately I don’t get the display to show anything.

 mos call I2C.Scan

showed me to use the above I2C address (actually it showed 62, but the Grove datasheet told me to use the above one).

0x34 is the hexadecimal representation of decimal 62.