Created
November 11, 2022 10:15
-
-
Save ahoNerd/933d96f9ecbc4743aab899dd25a9f401 to your computer and use it in GitHub Desktop.
ESP8266 OLED Display, read more at https://ahonerd.com/esp8266-oled-display
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
Mohamad Ramdan | |
Complete project details at https://ahonerd.com | |
***/ | |
#include "SSD1306.h" | |
SSD1306 display(0x3c, D2, D1); | |
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()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
Mohamad Ramdan | |
Complete project details at https://ahonerd.com | |
***/ | |
#include "SSD1306.h" | |
#include "font.h" | |
SSD1306 display(0x3c, D2, D1); | |
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()); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*** | |
Mohamad Ramdan | |
Complete project details at https://ahonerd.com | |
***/ | |
#include "SSD1306.h" | |
#include "android_logo.h" | |
SSD1306 display(0x3c, D2, D1); | |
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