Simple text only SSD1306 OLED Driver


I put a basic SSD1306 OLED driver up here that is designed with only text in mind to keep it small. It has a tiny host RAM footprint since no internal framebuffer is required.

You can copy and paste the .cpp and .h file into Spark Build by using the “+” button to add a new file to a project, and here’s an example of how to use it:

#include "ssd1306.h"

lcd_t lcd;

void setup() {
    // Initialize the display with the Reset, CS and DC pins
    ssd1306_init(&lcd, D1, D2, D0);
    ssd1306_print(&lcd, "Hello World!");

void loop() {
    char buf[16];
    // Move to the second line, populate a string and print it out
    ssd1306_cursor(&lcd, 0, 1);
    snprintf(buf, 16, "Millis: %u", millis());
    ssd1306_print(&lcd, buf);

I’ve only tested this with the 128x32 module from Adafruit which is a very tiny screen (module is about the size of the spark core itself). It is quite legible within a distance of a few feet since it’s bright with high contrast. Viewing angle issues with traditional LCDs are non-existent. It fits 4 lines with 21 characters of text per line. A few changes will have to be made to support the 128x64 module.


cool! I will change this thread under Libraries to better reflect your stuff :smiley:

Also, you can consider publishing to the community so that anyone can simply include in their app :wink: