Skip to content

Instantly share code, notes, and snippets.

@thomasstr
Created December 30, 2018 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasstr/17387f2416d48771b1109e196fd4ca15 to your computer and use it in GitHub Desktop.
Save thomasstr/17387f2416d48771b1109e196fd4ca15 to your computer and use it in GitHub Desktop.
/* Hello World OLED Test */
#include "SSD1306.h" // alias for `#include "SSD1306Wire.h"`
SSD1306 display(0x3c, 4, 5); // Initialise the OLED display using Wire library (D2 and D1 on NodeMCU)
void setup()
{
Serial.begin(9600);
display.init(); // Initialising the UI will init the display too.
display.flipScreenVertically();
display.normalDisplay();
display.clear();
drawHelloWorld();
display.display();
}
void loop()
{
}
void drawHelloWorld()
{
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);
display.drawString(0, 0, "Hello world");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment