Last active
June 6, 2018 09:10
-
-
Save codelectron/6936ca59b61de6b2f7f5e7566f358b8e to your computer and use it in GitHub Desktop.
This gist is part of the article http://codelectron.com/interface-nokia-5110-lcd-and-raspberry-pi-python/
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
#! /usr/bin/python | |
from luma.core.interface.serial import spi | |
from luma.core.render import canvas | |
from luma.lcd.device import pcd8544, st7735, uc1701x | |
from PIL import ImageFont, ImageDraw | |
from RPi import GPIO | |
from luma.lcd.aux import backlight | |
serial = spi(port=0, device=0, gpio_DC=23, gpio_RST=24) | |
channel=18 | |
light = backlight(gpio_LIGHT=channel, active_low=False) | |
light.enable(True) | |
device = pcd8544(serial,rotate=2) | |
with canvas(device) as draw: | |
font = ImageFont.truetype('./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