Skip to content
SSD1306, SSD1315 and SSH1106 OLED screen driver
C C++
Branch: master
Clone or download

Latest commit

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples/OLED_demo arduino library added Mar 21, 2020
images arduino library added Mar 21, 2020
LICENSE
README.md
font6x8.h arduino library added Mar 21, 2020
font8x16.h
library.json
library.properties
ssd1306xled.cpp
ssd1306xled.h arduino library added Mar 21, 2020

README.md

SSD1306XLED

This library is the driver for SSD1306, SSD1315 and SSH1106 based OLED screens. The original implementation is from Neven Boyanov, Tinusaur Team.

There were some compatibility issues with the I2C implementation of original ssd1306xled which I resolved by using the implementation from TinyI2C by David Johnson-Davies.

This library is tested on Attiny85 and some Chinese OLED screens based on these drivers.

Connection

OLED Attiny85
vcc vcc
gnd gnd
scl pb2
sda pb0

breadboard connection

schematic

Installation

  • PlatformIO: pio lib install "ssd1306xled" or visit library page
  • Arduino IDE: open library manager (Tools > Manage library) and search for ssd1306xled and install
  • Manual: Download the latest release here

How to use the code

  • Hello world code
#include <Arduino.h>
#include <ssd1306xled.h>

void setup() {
    _delay_ms(40);
    SSD1306.ssd1306_init();
}

void run() {
    SSD1306.ssd1306_fillscreen(0);
    SSD1306.ssd1306_setpos(0, 1);
    SSD1306.ssd1306_string_font6x8("Hello world!");
}
  • Library functions
    • void ssd1306_init(void): initializes the screen
    • void ssd1306_send_data_start(void): put the communication with a screen in data mode
    • void ssd1306_send_data_stop(void): stops the communication
    • void ssd1306_send_byte(uint8_t byte): send data byte to screen
    • void ssd1306_send_command_start(void): put the communication with a screen in command mode
    • void ssd1306_send_command_stop(void): stops the communication
    • void ssd1306_send_command(uint8_t command): send command byte to screen
    • void ssd1306_setpos(uint8_t x, uint8_t y): sets the cursor position at given coordinate
    • void ssd1306_fillscreen(uint8_t fill): fill the screen with given data (provide 0 as an argument to clear screen)
    • void ssd1306_char_font6x8(char ch): print a character with font size 6x8
    • void ssd1306_string_font6x8(char *s): print a given string with font size 6x8
    • void ssd1306_char_f8x16(uint8_t x, uint8_t y, const char ch[]): print entire array with font size 8x16
    • void ssd1306_draw_bmp(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1, const uint8_t bitmap[]): draws the bitmap to the screen

Contribution

You can improve this library by your contribution. If you want to improve the code or have a fix for some issues with the library, please feel free to fork this library and submit a new pull request with your changes and description

Credits

This code is mainly written by Neven Boyanov, Tinusar team. I replaced their I2C implementation with the implementation by David Johnson-Davies (TinyI2C).

Versions

  • v0.0.1 (March 08, 2020)
    • initial release
You can’t perform that action at this time.