CodeHub
HomeUploadContact
Back to Hub

text on oled dipslay

April 17, 2026 Watch Tutorial

Wiring Schematic

text on oled dipslay wiring diagram

Hardware Required

  • Arduino Board
    Buy on Amazon

Source Code

Arduino / C++
1#include <Wire.h>
2#include <Adafruit_GFX.h>
3#include <Adafruit_SSD1306.h>
4
5#define SCREEN_WIDTH 128
6#define SCREEN_HEIGHT 64
7#define OLED_RESET    -1 
8Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
9
10void setup() {
11  Serial.begin(115200);
12  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { 
13    for(;;);
14  }
15  display.setTextColor(WHITE);
16  display.clearDisplay();
17}
18
19void loop() {
20  display.clearDisplay();
21  display.display();
22  delay(1000); 
23
24  // ==========================================
25  // PAGE 1: THE SETUP
26  // All Text is SIZE 2 (Massive & Readable)
27  // Max 10 Characters per line!
28  // ==========================================
29  
30  // Y = 0 (Fits perfectly in the top Yellow band)
31  typeWrite("Are you a", 10, 0, 80);  
32  
33  // Y = 16, 32, 48 (Fills the bottom Blue band)
34  typeWrite("10k", 46, 16, 80);       
35  typeWrite("pull-up", 22, 32, 80);   
36  typeWrite("resistor?", 10, 48, 80); 
37
38  delay(2500); // Wait 2.5 seconds so they can read it
39  display.clearDisplay(); // Wipe the screen clean!
40  display.display();
41  delay(500);
42
43  // ==========================================
44  // PAGE 2: THE PUNCHLINE
45  // ==========================================
46  
47  // Top Yellow Band
48  typeWrite("Because", 22, 0, 80);
49  
50  // Bottom Blue Band
51  typeWrite("you always", 4, 16, 80);
52  typeWrite("PULL ME UP", 4, 32, 100); 
53  typeWrite("when low..", 4, 48, 120); // Types slower at the end for emotion
54
55  delay(5000); // Hold the punchline for 5 seconds
56}
57
58// ==========================================
59// THE BIG TYPEWRITER ENGINE
60// ==========================================
61void typeWrite(const char* text, int x, int y, int typingSpeed) {
62  display.setTextSize(2); // Locked to BIG size
63  display.setCursor(x, y);
64  
65  for (int i = 0; i < strlen(text); i++) {
66    display.print(text[i]);
67    display.display(); 
68    delay(typingSpeed); 
69  }
70}
Breadboard
Buy on Amazon
  • SSD1306 module
    Buy on Amazon
  • Jumper Wires
    Buy on Amazon
  • USB Cable
    Buy on Amazon