Display OLED SSD1306 with LilyGO T-Beam

esp32 t-beam lilygo display oled ssd1306

This example contains the code to display a bunch of Hello world on the OLED display SSD1306.

  1. Install Arduino library dependancy for the OLED display SSD1306

     arduino-cli lib install "ESP8266 and ESP32 OLED driver for SSD1306 displays"
    
  2. Run make to compile and upload the code
  3. Connect to the serial monitor

Code

Download code
#include "src/oled/oled.h"

void setup() {
  Serial.begin(9600);
  initOLED();
}

void loop() {
  Serial.print("Updating display at ");
  Serial.print(millis());
  Serial.println("ms");

  displayOLED();
  delay(2000);
}

Makefile

BOARD?=esp32:esp32:t-beam
PORT?=/dev/cu.SLAB_USBtoUART

.PHONY: default lint all flash clean

default: all flash clean

lint:
	cpplint --extensions=ino --filter=-legal/copyright *.ino

all:
	arduino-cli compile --fqbn $(BOARD) ./

flash:
	arduino-cli upload -p $(PORT) --fqbn $(BOARD)

clean:
	rm -r build

Serial console

Serial output from the firmware.

Display OLED SSD1306 with LilyGO T-Beam serial console

Prototype

A photo of the actual setup.

Display OLED SSD1306 with LilyGO T-Beam prototype

References