Last active
March 15, 2019 14:16
-
-
Save codelectron/5370a68555b34b202eba8b1b4083b3a1 to your computer and use it in GitHub Desktop.
This luma oled example code is part of the article http://codelectron.com/setup-oled-display-raspberry-pi-python/
This file contains 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
from luma.core.interface.serial import i2c | |
from luma.core.render import canvas | |
from luma.oled.device import ssd1306, ssd1325, ssd1331, sh1106 | |
import time | |
serial = i2c(port=1, address=0x3C) | |
device = ssd1306(serial, rotate=0) | |
# Box and text rendered in portrait mode | |
with canvas(device) as draw: | |
draw.rectangle(device.bounding_box, outline="white", fill="black") | |
draw.text((10, 40), "WWW.CODELECTRON.COM", fill="white") | |
while 1: | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment