You will need pull up resistors (4.7K or 2.2K) from the D0 and D1 to 3V3 for the I2C bus to operate. Otherwise the voltage will float around. Try that first.
I have Oled displays looking much like the one on the picture.
Some of mine use the SH1106 chip and not the SSD1306 chip - and using the Adafruit_SSD1306 library gives a result like your picture.
But they work fine with the SH1106 library – I ended up porting a library supporting the Adafruit_GFX library (as I remember, a long time ago, didn’t invest a lot time in it).
I have 10+ of these cheap ebay Oled displays and wasted a lot time bc of different default I2C addresses and driver chips. If the pull-ups don’t do the trick, do a I2C scan to verify the address and try the SH1106 library
I suggest you use the following libraries and ensure the screen size is correctly set - I guess 128 x 64? This is the example application for the Adafruit OLED feather backpack
#include <Adafruit_GFX_RK.h>
#include <Adafruit_SSD1306_RK.h>
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 32);
#define BUTTON_A D4
#define BUTTON_B D3
#define BUTTON_C D2
void setup()
{
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Address 0x3C for 128x32
// Show image buffer on the display hardware.
// Since the buffer is intialized with an Adafruit splashscreen
// internally, this will display the splashscreen.
display.display();
delay(1000);
// Clear the buffer.
display.clearDisplay();
display.display();
pinMode(BUTTON_A, INPUT_PULLUP);
pinMode(BUTTON_B, INPUT_PULLUP);
pinMode(BUTTON_C, INPUT_PULLUP);
// text display tests
display.setTextSize(1);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.print("Working Display");
display.setCursor(0,0);
display.display(); // actually display all of the above
}
void loop()
{
if(!digitalRead(BUTTON_A)) display.print("A");
if(!digitalRead(BUTTON_B)) display.print("B");
if(!digitalRead(BUTTON_C)) display.print("C");
delay(10);
yield();
display.display();
}