Last active
April 14, 2018 18:35
-
-
Save codelectron/2953af80eedcb6ef4bd754cf80b146e8 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 | |
from PIL import ImageFont, ImageDraw | |
serial = i2c(port=1, address=0x3C) | |
device = ssd1306(serial, rotate=0) | |
# Box and text rendered in portrait mode | |
with canvas(device) as draw: | |
font = ImageFont.truetype('./ssd1306/fonts/Volter__28Goldfish_29.ttf',20) | |
draw.text((0, 0), "Hello World", font=font, fill=255) | |
raw_input("Enter to Exit") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment