Skip to content

Instantly share code, notes, and snippets.

@biazzotto
Forked from laurivosandi/esp32-oled-demo.py
Created September 7, 2018 17:35
Show Gist options
  • Save biazzotto/d6adc26e86818e7f0f629c5375163bf3 to your computer and use it in GitHub Desktop.
Save biazzotto/d6adc26e86818e7f0f629c5375163bf3 to your computer and use it in GitHub Desktop.
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