Adafruit_SSD1306 display and additional I2C Device

Hello all,

in a former project I only used 1 device (display) on I2C, now I want to use an BMP280 sensor additionally.

I initialized it with:

Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);

Now that I use the additional device this does not work any more. BUT it works with :

#define OLED_RESET 1
Adafruit_SSD1306 display(OLED_RESET);

Unfortunately the output on the display looks different (bigger) and I cannot use 5 rows as I used to.

What am I doing wrong? See sketch in attached txt file.

Thank you for your support!

displayCode.txt (2.09 KB)

When you use the Adafruit_SSD1306 display(OLED_RESET); constructor overload, it causes the dimensions to be set to 128x32. This is the reason for the display looking different. This also causes the library to use less memory. So my suspicion is that you don't have enough SRAM available for that quite demanding sketch, which is causing it to "not work any more".

After a quick look at your sketch, I didn't see any easy ways to reduce memory usage. You might consider switching to a different Arduino board that has more memory.

Hello Pert,

thank you for your feedback and the code analysis!

Maybe it is possible to adapt the “Adafruit_SSD1306.h” file to adjust the hight when using “Adafruit_SSD1306 display(OLED_RESET);”?

What is the <&Wire used for in
“Adafruit_SSD1306 display(128, 64, &Wire, OLED_RESET);”

Thank you.