Skip to content

Instantly share code, notes, and snippets.

@codelectron
Last active April 14, 2018 18:35
Show Gist options
  • Select an option

  • Save codelectron/e5cf4806272867585d233b6fadae2252 to your computer and use it in GitHub Desktop.

Select an option

Save codelectron/e5cf4806272867585d233b6fadae2252 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/
from PIL import ImageFont, ImageDraw
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.line((0,0 , 20 , 20 ), fill="white")
raw_input("Enter to exit")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment