-
-
Save biazzotto/d6adc26e86818e7f0f629c5375163bf3 to your computer and use it in GitHub Desktop.
OLED screen demo on ESP32 with MicroPython
This file contains hidden or 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
# 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