Which SSD1306 library for STM32

Hi, I have a blackpill board and can upload fine to it. I don't know which library to use for this OLED and Arduino IDE, can you guys help me out. Thanks

oled.PNG

oled.PNG

The two most popular libraries are
Adafruit_SSD1306
U8g2lib

Both should work out of the box.

I presume you are using the Official STM32 Core from STMicroelectronics.

Please do not use the RogerClark Maple Core

David.

Hi faisal071

With some (cheap, AliExpress) 128*32 OLEDs the AdafruitSSD1306 won't work.
There is also the older version of U8g2lib which with all OLEDS and also in cases of the 'obnoxious' OLEDs might work (never be too sure, though!):
Google for the U8glib library and then upload the sketch below.
Good luck, Photoncatcher

// OLED_SSD1306_128x32_hello_world
//
// 128x32 OLED 4-pin I2C monochrome SSD1306 controller
// July 7, 2020
// Public Domain


   #include "U8glib.h"

// constructor

   U8GLIB_SSD1306_128X32 u8g(U8G_I2C_OPT_NONE);  // I2C / TWI 

void setup() {  
  u8g.setFont(u8g_font_unifont);
  u8g.setColorIndex(1); // Instructs the display to draw with a pixel on. 
}

void loop() {  
  u8g.firstPage();
  do {  
    draw();
  } while( u8g.nextPage() );
  delay(1000);   
}
  
void draw(){
  u8g.drawStr( 0, 20, "Hello World");   
}

,

Please post a link to the actual display that you have bought. e.g. Ebay sale page.

I would expect Adafruit_SSD1306 to work fine with all I2C 128x32 but perhaps photoncatcher can identify a specific display that does not work.

David.

Hi David,

quote "I would expect Adafruit_SSD1306 to work fine with all I2C 128x32 but perhaps photoncatcher can identify a specific display that does not work."

answer: mine (picture shows front and back). This is a nameless, cheap device I bought just for fun from some vendor at Aliexpress (the cheapest - I am Dutch ;-)). Inscription on front, right, says "7C08 703BX" After many fruitless attempts with the Adafruit library I finally got it humming with u8glib. What you see here is a still belonging to Muybridge's cat (20 frames animation).

regards, Photoncatcher

This topic was automatically closed after 120 days. New replies are no longer allowed.