Hi... I have used an OLED display (I2C,128x64) to show 'Hello World!' but the text is always shifted to the left, no matter what I try.
#include <U8glib.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
// create a U8glib display object connected to I2C
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE);
void setup() {
Serial.begin(9600);
if (u8g.getMode() == U8G_MODE_R3G3B2) {
u8g.setColorIndex(255); // white
} else if (u8g.getMode() == U8G_MODE_GRAY2BIT) {
u8g.setColorIndex(3); // max intensity
} else if (u8g.getMode() == U8G_MODE_BW) {
u8g.setColorIndex(1); // pixel on
} else if (u8g.getMode() == U8G_MODE_HICOLOR) {
u8g.setHiColorByRGB(255, 255, 255);
}
u8g.firstPage();
do {
draw();
} while (u8g.nextPage());
}
void draw() {
u8g.setFont(u8g_font_6x10);
u8g.drawStr(0, 15, "Hello World!");
}
void loop() {
// Nothing in the loop for this example
}