Skip to content

Instantly share code, notes, and snippets.

@afternoon
Created August 20, 2022 20:31
Show Gist options
  • Save afternoon/99665d0f3198949a26b31b8cc596fbc9 to your computer and use it in GitHub Desktop.
Save afternoon/99665d0f3198949a26b31b8cc596fbc9 to your computer and use it in GitHub Desktop.
#include <Arduino.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define DISPLAY_WIDTH_PX 128
#define DISPLAY_HEIGHT_PX 64
#define DISPLAY_ADDRESS 0x3D
Adafruit_SSD1306 display(DISPLAY_WIDTH_PX, DISPLAY_HEIGHT_PX, &Wire);
void setup() {
Serial.begin(115200);
while (!Serial) { }
if (!display.begin(SSD1306_SWITCHCAPVCC, DISPLAY_ADDRESS)) {
Serial.println("SSD1306 allocation failed");
for(;;); // don't proceed, loop forever
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.cp437(true);
display.println("hello, world");
display.display();
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment