Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.
0

Characters moving on the screen
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Characters moving on the screen

by nordpolemil on Sun Oct 11, 2020 3:02 pm

Hello,

I encountered a strange issue with the Adafruit Monochrome 128x32 OLED Display. Whenever I redraw the display, the offset moves a bit. So when I draw "hello world" the first time it appears on the screen where expected. When I call my draw function again it moves a bit in X and a bit in Y direction. When I call the draw function in a loop then the text wanders over the screen. I want it to stay where it is. Does anyone know why the text is not printed in the same location every time I call the draw function?

Btw. my display is connected to a Teensy LC.

I made an example code to reproduce the problem. I copied it together from the example codes.

Thank you :)

Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

void setup() {
  Serial.begin(9600);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  //display.setRotation(2);
}

void loop() {
 
  testdrawstyles();
  delay(100);
}

void testdrawstyles(void) {

  display.clearDisplay();

  display.setCursor(0,0);             // Start at top-left corner
  display.println("Hello, world!");

  display.display();
}

nordpolemil
 
Posts: 1
Joined: Sun Oct 11, 2020 2:56 pm

Please be positive and constructive with your questions and comments.