Replies: 2 comments
-
I uploaded a shortened version of Adafruits "Hello World" test onto the ESP32 board and found that the text is displayed correctly. So it seems to me that the problem is in U8G2. |
Beta Was this translation helpful? Give feedback.
-
Using the Adafruit_SH110X.h and Adafruit_GFX.h libraries provides the solution to the problem as well as a "screen saver" as I just found out. So I wil go this route and close this discussion. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am using the Adafruit 5297 128x128 OLED with the U8g2 library and have a problem with the way the text is displayed. The OLED is mounted into an enclosure with its top pointing up as described on Adafruits website. Using a simple code to display "Hello World!" starting at line position 0 shows: "World! Hello" .
If I use rotation 90 degrees the text shows correct, correct sequence, but of course turned sideways... 90 degrees.
I can't turn the OLED in the enclosure and I want to use U8G2 since it offers the power save mode and more importantly has the option to define the boards I2C SDA/SCL pins since my board (ESP32 Feather) is not using the defaults.
Any ideas how to get around this? Any help appreciated.
This is the test code:
#include <U8g2lib.h>
#include <Wire.h>
#define I2C_Adr 0x3d //OLED I2C address
#define SDA 23 //sda pin# on ESP32 board is 23 (some boards use 21)
#define SCL 22 //scl pin# on ESP32 board is 22
#define rotation U8G2_R0 //flawed, but I need this rotation
U8G2_SH1107_128X128_F_HW_I2C u8g2(rotation, U8X8_PIN_NONE, SCL, SDA);
void setup(void) {
int i2cAdr = (I2C_Adr * 2); //per u8g2 reference manual address must be multiplied by 2
u8g2.setI2CAddress(i2cAdr);
u8g2.begin();
u8g2.setFont(u8g2_font_helvR10_tf);
}
void loop(void) {
u8g2.clearDisplay();
u8g2.drawStr(0,15,"Hello World!");
u8g2.sendBuffer();
delay(500);
u8g2.drawStr(0,30,"1234567890");
u8g2.sendBuffer();
delay(1000);
}
B.t.w. "1234567890" displays like "567890 1234"
Beta Was this translation helpful? Give feedback.
All reactions