Go Down

Topic: 1.3" 128x64 I2C OLED pixel shifted? (Read 130 times) previous topic - next topic

Eheran

Display should be like:
T: 1.00        °C
H: 1.00        %
D: -49.72     °C
p: 1.00        hPa
h: 32452.9   m

But instead its weird shifted at the top but not at the bottom. Please take a look at the picture.
Its connected via HW I2C to a teensy 3.2 with pullups.
What am I doing wrong?
Here is my Display code:
Code: [Select]

#include <U8g2lib.h>
U8G2_SH1106_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);


Setup:
  u8g2_SetI2CAddress(u8g2.getU8g2(), 0x3C * 2);
  u8g2.begin();
  u8g2.enableUTF8Print();


Loop:
    u8g2.firstPage();
    do {
      u8g2.setFont(u8g2_font_unifont_t_latin);
      u8g2.setFontPosTop();
      u8g2.drawStr(0, 0, "T:");   u8g2.setCursor(20, 0);    u8g2.print(temp, 2);   u8g2.setCursor(80, 0);   u8g2.print("\260C");
      u8g2.drawStr(0, 12, "H:");  u8g2.setCursor(20, 12);   u8g2.print(hum, 2);    u8g2.setCursor(80, 12);  u8g2.print("%");
      u8g2.drawStr(0, 24, "D:");  u8g2.setCursor(20, 24);   u8g2.print(dew, 2);    u8g2.setCursor(80, 24);  u8g2.print("\260C");
      u8g2.drawStr(0, 36, "p:");  u8g2.setCursor(0, 36);    u8g2.print(press, 2);  u8g2.setCursor(80, 36);  u8g2.print("hPa");
      u8g2.drawStr(0, 48, "h:");  u8g2.setCursor(0, 48);    u8g2.print(alt, 1);    u8g2.setCursor(80, 48);  u8g2.print("m");
      u8g2.sendBuffer();          // transfer internal memory to the display
    } while ( u8g2.nextPage() );

olikraus

"u8g2.sendBuffer(); " is not required. This will be done automatically by the nextPage procedure.

Oliver

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy