Integrate the SH1106 O-LED Driver

Hello Guys

I started to work with XOD a few week ago and im really loving it!
Now ive got a Display with a SH 1106 Driver instead of a SSD1306…

On Hackaday ive found, thats the only difference between them is the Memory- Map (132 instead of 124).
Its my first time, i try to implement a C++ Library and im not sure how to do this… which would be the best way to do it? Can i just change the existing SSD1306 node to another library (maybe [https://github.com/olikraus/u8g2](U8G2 from Olikraus), or OLED SSD1306 - SH1106 from Fabio Durigon(cannot post 2 links maybe google it))

Does anyone have a few hints for me, how to do this?

Thanks and greetings

Benjamin

Hi Benjamin,

You’ve essentially got two options:

  1. If you want to use the xod/graphics nodes, then you will need to write a compatible library for the SH1106. You could use xod-dev/ssd1306-display as a template. Note that xod-dev/ssd1306-display wraps an Arduino C++ library: https://github.com/xodio/xod/tree/master/workspace/ardulib/SSD1306. You will need to create a similar Arduino library for the SH1106.
  2. An alternative approach would be to wrap one of the Arduino libraries you mentioned (U8G2 or OLED SSD1306 - SH1106). Instructions for wrapping Arduino libraries can be found here: https://xod.io/docs/guide/wrapping-arduino-libraries/. In this case you will create your own graphics nodes from the methods in the Arduino library, rather than make use of the xod/graphics nodes.

I used the 2nd approach to create wayland/ssd1306-oled-i2c/ from https://github.com/adafruit/Adafruit_SSD1306.

Hey Wayland!

Thanks alot for your answer… ive started now with your 2nd advice and try to get it work… :wink:

Started to create mine on the base of your oled- i2c wrapper… seems to work until i want to load a second header out of the u8g2lib.h (u8x8.h that should be downloaded with the rest of the github stuff)

Best Benjamin

Looks like you’ve got a typo. The u in u8x8lib.h should be upper case.

I’m not very familiar with olikraus’s libraries, but I wonder if you would be better off using https://github.com/olikraus/U8g2_Arduino rather than https://github.com/olikraus/u8g2?

One other thing to note, I created my oled library a while ago, so it uses the old-style c++ syntax. The old-style code remains compatible with the latest version of XOD, but the new syntax introduced in v0.35 is more succinct. See https://xod.io/docs/guide/migrating-to-v035/?utm_source=release&utm_campaign=0_35_0&utm_medium=medium