Last active
November 21, 2018 07:29
-
-
Save IdrisCytron/2dfdf6e95df142c938b0a9c00bd3a229 to your computer and use it in GitHub Desktop.
Displaying on MAX7219 Dot Matrix using Raspberry Pi based on Luma.LED_Matrix library.
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
import RPi.GPIO as GPIO | |
from time import sleep, strftime | |
from datetime import datetime | |
from luma.core.interface.serial import spi, noop | |
from luma.core.render import canvas | |
from luma.core.virtual import viewport | |
from luma.led_matrix.device import max7219 | |
from luma.core.legacy import text, show_message | |
from luma.core.legacy.font import proportional, CP437_FONT, LCD_FONT | |
serial = spi(port=0, device=0, gpio=noop()) | |
device = max7219(serial, width=32, height=8, block_orientation=-90) | |
device.contrast(5) | |
virtual = viewport(device, width=32, height=16) | |
show_message(device, 'Raspberry Pi MAX7219', fill="white", font=proportional(LCD_FONT), scroll_delay=0.08) | |
try: | |
while True: | |
with canvas(virtual) as draw: | |
text(draw, (0, 1), "Idris", fill="white", font=proportional(CP437_FONT)) | |
#text(draw, (0, 1), datetime.now().strftime('%I:%M'), fill="white", font=proportional(CP437_FONT)) | |
except KeyboardInterrupt: | |
GPIO.cleanup() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment