OLED Display position for text display

I'm using Nodemcu-32S ( ESP32S Wroom) and 1.3 inch I2C OLED Display

My display .

It's a SH1106 based 124*64 OLED display and hence I'd tried but Adafruit library didn't work. I'm using squix78’s OLED library library.

Now I'm facing problem to set positioning for text display in the following code:

    display.setTextAlignment(TEXT_ALIGN_CENTER);
    display.setFont(ArialMT_Plain_16);
    display.drawString(0, 0, "Connected");
    display.setFont(ArialMT_Plain_16);
    display.drawString(0, 16, "System OK");
    display.setFont(ArialMT_Plain_16);
    display.drawString(0,32, "Time");

The TEXT_ALIGN_CENTER Alignment didn't work. It shows like this:

I want set position for three line text, center text alignment and font size 16.

Please help to learn how to determine position.

Also I want to show battery and wifi icon in top row like this display:

I've not used that library but when you do

    display.setTextAlignment(TEXT_ALIGN_CENTER);

you are indeed likely to ask for centering text around an anchor point.

and when you do

    display.drawString(0, 0, "Connected");

I would bet that this anchor point is (0,0) so you only see half of the text on screen (the left half being below 0 so invisible).
Same for the others

you should do

    display.drawString(64, 0, "Connected"); // 64 = screen X Center

so something like this probably happens

Hey, nice picture!

a7

Hi mnhpias,

There could be also an issue with the library you use.
There exists a library for SSD1106-SH1106 on www.arduinolibraries:

and remember what alto777 commented.

success, photoncatcher