Oled 128x64 display problem

I tested my display with succes. Its an 128x64 produino Oled ic2 with 4 pins (vcc, ground, sda, scl).

I connect these to the right pins on my mega 2560 (pins 20,21 i think).

A few projects later the display is partially filled
With random buffer data, and the fullscreen i used to have is now located in the middle section of the screen (resized, so no loss of the image). See photo. The examples from adafruit worked perfectly, but now it worls only in the middlepart of the screen, but resized to a smaller scale. I use pullup resistors on sda and scl.

What can cause this? I use the same code, and the same connections.

Kind regards,

Robin

The smaller versions of the SSD1306 (e.g. 64x32) display the middle pixels of a bigger virtual screen size. Perhaps you've somehow specified a different version of the display.

You can try my SSD1306 code as an alternative. It assumes you're using the 128x64 version:

https://github.com/bitbank2/oled_96