Issue with OLED Display

With the following code, the Qwiic OLED isn’t displaying as intended. How could I troubleshoot this?

#include <Wire.h>
#include <SparkFun_Qwiic_OLED.h>

QwiicMicroOLED myOLED;

String msg = "Access Granted";

int x0, y0;

void setup() {
  if (myOLED.begin() == false) {
    Serial.println("OLED begin failed. Freezing...");
    while (true)
        ;
  }

   x0 = (myOLED.getWidth() - myOLED.getStringWidth(msg)) / 2;
    // starting y position - screen height minus string height / 2 
    y0 = (myOLED.getHeight() - myOLED.getStringHeight(msg)) / 2;

   myOLED.text(x0, y0, msg, 1);

    myOLED.display();

}

void loop() {
  // put your main code here, to run repeatedly:

}

Hi @CloudInnovations ,

Replace QwiicMicroOLED with Qwiic1in3OLED. There is some example code you can reuse in the Hookup Guide - link below.

Best wishes,
Paul

1 Like