Skip to content

CPP: SDD1306

Leo Vidarte edited this page Mar 8, 2017 · 3 revisions

The SDD1306 is a driver for Oled Displays.

Download the project

Checkout this PlatformIO project code here.

Libs installation

We need the following library https://libraries.io/platformio/SSD1306

$ platformio lib install 562
Library Storage: /home/lvidarte/Projects/Arduino/SSD1306/.piolibdeps
LibraryManager: Installing id=562
Downloading  [####################################]  100%          
Unpacking  [####################################]  100%
ESP8266_SSD1306 @ 3.2.5 has been successfully installed!

Code

#include <SSD1306.h>

#define SDA 4
#define SCL 5

SSD1306 display(0x3c, SDA, SCL);

void setup ()
{
  display.init();
  display.flipScreenVertically();

  display.clear();
  display.drawString(0, 0, "Hello");
  display.drawString(0, 10, "World");

  display.drawCircle(50, 30, 10);
  display.drawRect(10, 30, 10, 10);
  display.display();
}

void loop ()
{
}