Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By Romek
#92630 Hi everyone,
I am struggling to solve how to display inverted text if i use custom fonts. With regular font it works, but font size "display.setTextSize(1);" or "display.setTextSize(2);" is too small or too big for me. So my code is following:
Code: Select all#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

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

#include <Fonts/FreeSerif9pt7b.h>

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);

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

  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for(;;);
  }
  delay(2000);
  display.clearDisplay();

  display.setTextSize(1);
  display.setFont(&FreeSerif9pt7b);
  display.setTextColor(BLACK,WHITE);  // <<-- This is supposed to be inverted text, but it does not show anything on display.....
  display.setCursor(0, 30);
  display.println("Hello, world!");
  display.display();
}

void loop() {
 
}


Any ideas how to make it work? I am to a programmer, just hobbyist....
You do not have the required permissions to view the files attached to this post.