Hi all,
I have got a SH1106 OLED display.
As I was experimenting with it a vertical line of pixels appeared on the right of the screen and they cannot be removed.
I have also noticed that text aliment is set at minus 2 pixels.
These faults can be seen on the picture below.
Is my OLED faulty, or there is something I can do?
Regards and thank you.
Code and screen shot below.
include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#define OLED_MOSI 26
#define OLED_CLK 25
#define OLED_DC 14
#define OLED_CS 12
#define OLED_RST 27
// Create the OLED display
Adafruit_SH1106G display = Adafruit_SH1106G(128, 64, OLED_MOSI, OLED_CLK, OLED_DC,
OLED_RST, OLED_CS);
void setup()
{
testme();
}
void loop()
{}
void testme()
{
display.begin(0, true);
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SH110X_WHITE);
display.setCursor(0, 0);
display.print("Text at 0,0");
display.setCursor(1, 20);
display.print("Text at 1,20");
display.setCursor(2, 40);
display.print("Text at 2,40");
display.display();
delay(1);
Which OLED do you have? Any link to the details about it? Is it a 128 x 64 pixel display?
I ran your program on a genuine SPI SH1106 on a M0 Pro via the Web Editor.
My display hardware looks like your photo. But the output was correct.
Of course we really need to see the pcb view for a proper comparison.
Anyway, my display worked just fine (with up to date Adafruit_SH110X library)
Using library SPI at version 1.0 in folder: /home/builder/.arduino15/packages/arduino/hardware/samd/1.8.13/libraries/SPI
Using library Wire at version 1.0 in folder: /home/builder/.arduino15/packages/arduino/hardware/samd/1.8.13/libraries/Wire
Using library adafruit_gfx_library_1_11_3 at version 1.11.3 in folder: /home/builder/opt/libraries/adafruit_gfx_library_1_11_3
Using library adafruit_busio_1_13_1 at version 1.13.1 in folder: /home/builder/opt/libraries/adafruit_busio_1_13_1
Using library adafruit_sh110x_2_1_7 at version 2.1.7 in folder: /home/builder/opt/libraries/adafruit_sh110x_2_1_7
You don't say which Arduino you are using.
I can see where the display.display(); is going wrong.
I suspect that you have an obsolete Adafruit_SH110X version.
David.
HI David.
thank you for setting me on the right track.
I did check the library and it was the latest.
However I re-installed i the library and now the problem is gone.
Thank you to all.
Have a nice day.
My advice is always : Post a link to the actual hardware display that you have bought. e,g. Ebay sale page.
This generally has photos of front and back. Best way to identify the item.
Yes, I know that your screen output was "wrong". It seemed to be a SH1106 library problem. And you have resolved it by re-installing / updating the library.
But often we don't know or can't trust the user's description.
Advertising Photos are the best way to give the information. i.e. a picture is worth a 1000 words!!
David.