Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
Last active November 22, 2021 18:30
Show Gist options
  • Select an option

  • Save tlrobinson/dd8cf7d0638bdf49f64812a77f7a798c to your computer and use it in GitHub Desktop.

Select an option

Save tlrobinson/dd8cf7d0638bdf49f64812a77f7a798c to your computer and use it in GitHub Desktop.
Using the OLED display on TTGO LoRa32 development boards and "ESP8266 and ESP32 OLED driver for SSD1306 displays" library
#include <Wire.h> // Only needed for Arduino 1.6.5 and earlier
#include "SSD1306Wire.h" // legacy: #include "SSD1306.h"
SSD1306Wire display(0x3c, 4, 15);
void setup() {
pinMode(16, OUTPUT);
digitalWrite(16, LOW); // set GPIO16 low to reset OLED
delay(50);
digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 in high
display.init();
display.flipScreenVertically();
display.setFont(ArialMT_Plain_10);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.clear();
display.drawStringMaxWidth(0, 0, 128,
"Lorem ipsum\n dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore." );
display.display();
}
void loop() {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment