Skip to content

Instantly share code, notes, and snippets.

@codelectron
Last active April 14, 2018 18:36
Show Gist options
  • Save codelectron/69a21980371ef12742aae891cbfa6d9d to your computer and use it in GitHub Desktop.
Save codelectron/69a21980371ef12742aae891cbfa6d9d 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 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.point((5,9),fill=255)
draw.point((6,9),fill=255)
draw.point((7,9),fill=255)
draw.point((8,9),fill=255)
draw.point((9,9),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