Skip to content

Instantly share code, notes, and snippets.

@ahoNerd
Last active November 11, 2022 10:07
Show Gist options
  • Save ahoNerd/644d29fcbedaa4e8fe98d42004742a2f to your computer and use it in GitHub Desktop.
Save ahoNerd/644d29fcbedaa4e8fe98d42004742a2f to your computer and use it in GitHub Desktop.
ESP32 OLED Display, read more at https://ahonerd.com/esp32-oled-display
/***
Mohamad Ramdan
Complete project details at https://ahonerd.com
***/
#include "SSD1306.h"
SSD1306 display(0x3c, 21, 22);
long lastDisp = 0;
void oledLoop(long now) {
if(now - lastDisp > 1000) {
lastDisp = millis();
display.clear();
display.setFont(ArialMT_Plain_16);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(0, 0, "Test Display");
display.drawString(0, 23, "SSD1306");
display.setTextAlignment(TEXT_ALIGN_RIGHT);
display.drawString(128, 0, String(random(60)));
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.drawString(64, 46, "ahoNerd.com");
display.display();
}
}
void setup() {
display.init();
display.flipScreenVertically();
}
void loop() {
oledLoop(millis());
}
/***
Mohamad Ramdan
Complete project details at https://ahonerd.com
***/
#include "SSD1306.h"
#include "font.h"
SSD1306 display(0x3c, 21, 22);
long lastDisp = 0;
void oledLoop(long now) {
if(now - lastDisp > 1000) {
lastDisp = millis();
display.clear();
display.setTextAlignment(TEXT_ALIGN_CENTER);
display.setFont(ArialMT_Plain_16);
display.drawString(64, 10, "ahonerd.com");
display.setFont(URW_Chancery_L_Medium_Italic_22);
display.drawString(64, 34, "ahonerd.com");
display.display();
}
}
void setup() {
display.init();
display.flipScreenVertically();
}
void loop() {
oledLoop(millis());
}
/***
Mohamad Ramdan
Complete project details at https://ahonerd.com
***/
#include "SSD1306.h"
#include "android_logo.h"
SSD1306 display(0x3c, 21, 22);
void setup() {
display.init();
display.flipScreenVertically();
display.clear();
display.drawXbm(32, 0, android_width, android_height, android_bits);
display.display();
}
void loop() {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment