Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OLED screen demo on ESP32 with MicroPython
# Pull the SDD1306 lib from here https://github.com/adafruit/micropython-adafruit-ssd1306/blob/master/ssd1306.py
from time import sleep_ms
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
buf = "wubba lubba dub dub "
i2c = I2C(-1, Pin(4),Pin(5),freq=40000) # Bitbanged I2C bus
assert 60 in i2c.scan(), "No OLED display detected!"
oled = SSD1306_I2C(128, 64, i2c)
oled.invert(0) # White text on black background
oled.contrast(255) # Maximum contrast
for j in range(0, 500):
oled.fill(0)
oled.text(buf[j%len(buf):]+buf, 10, 10)
oled.show()
sleep_ms(40)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.