Check also new C++ library lcdgfx. It consumpts less memory, has simple C++ api
SSD1306 driver is Arduino style C/C++ library with unicode support. The library can be compiled for plain Linux (for example, raspberry spi), or you can use it with plain avr-gcc compiler without Arduino IDE. It supports monochrome and RGB oleds and has debug mode, allowing to execute code on PC, using SDL2.0. Initially the library is intended for very small microcontrollers (with a little of RAM). It was developed to use as few resources as possible, but still has powerful capabilities (NanoEngine), allowing to develop nice animation. It works on any powerful devices like raspberry pi, esp32; and can be easily ported to new platform.
You can find the online simulation for one of the examples from the library here
The i2c pins can be changed via API functions. Please, refer to documentation. Keep in mind, that the pins, which are allowed for i2c or spi interface, depend on the hardware. The default spi SCLK and MOSI pins are defined by SPI library, and DC, RST, CES pins are configurable through API.
|pcd8544 84x48||X||Nokia 5110|
|vga 96x40 color||direct D-sub output, atmega328p only|
|vga 128x64 bw||direct D-sub output, atmega328p only|
|Attiny85, Attiny45||X||X||Refer to Damellis attiny package|
|Attiny84, Attiny44||X||X||Refer to Damellis attiny package|
|Digispark, including PRO version||X||X||check examples compatibility list|
|ESP8266||X||X||check examples compatibility list|
|ESP32||X||X||check examples compatibility list|
|Nordic nRF5 (nRF51, nRF52)||X||X||via Standard Arduino nRF52 boards. nRF users, enable c++11 in platform.txt
|Nordic nRF5 (nRF51, nRF52)||X||X||via Sandeep Mistry arduino-nRF5 package|
|ESP32||X||X||library can be used as IDF component|
|Raspberry Pi||X||X||i2c-dev, spidev, sys/class/gpio|
|SDL Emulation||X||X||demo code can be run without real OLED HW via SDL library|
|SDL Emulation||X||X||demo code can be run without real OLED HW via MinGW32 + SDL library|
Digispark users, please check compilation options in your Arduino prior to using this library. Ssd1306 library requires at least c++11 and c99 (by default Digispark package misses the options -std=gnu11, -std=gnu++11).
i2c Hardware setup is described here
Setting up for Arduino from github sources)
Setting up for Arduino from Arduino IDE library manager
Using with plain avr-gcc:
For more information about this library, please, visit https://github.com/lexus2k/ssd1306. Doxygen documentation can be found at github.io site. If you found any problem or have any idea, please, report to Issues section.
The library is free. If this project helps you, you can give me a cup of coffee.
Copyright (c) 2016-2021, Alexey Dynda
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.