Esp8266 + i2c oled

#1

Hi I am having problem with connecting OLED display via I2C.

My setup

  • ESP8266 (Wemos D1)
  • OLED 128x64 SSD1306
  • wiring:
    i2c.sda - GPIO 4 (D2)
    i2c.scl - GPIO 5 (D1)
  - ["i2c.enable", true]
  - ["i2c.sda_gpio", 4]
  - ["i2c.scl_gpio", 5]

mos call I2C.Scan detects the display-> [ 60 ].

The code sample I am trying to run is:


with the difference where I updated I2C address to 0x3c (60)

I was looking for an answer here, but I didn’t find the solution yet - https://forum.mongoose-os.com/discussion/1106/i2c-oled-not-working.

What else can I do? How else can I debug the problem?

I know the I2C display is working fine, because I got it working using different firmware (espruino).

#2

Ok, I found it. I am new to mongoose, so I made this rookie mistake :confused:

Except import libs in JS code init.js file I also should import libs by adding them to mos.yml.

In my particular case those are:

    # libs necessary for the current app
  - origin: https://github.com/mongoose-os-libs/arduino-adafruit-ssd1306
  - origin: https://github.com/mongoose-os-libs/mj