led_test.py 882 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Copyright (c) 2017-18 Richard Hull and contributors
  4. # See LICENSE.rst for details.
  5. import re
  6. import time
  7. import argparse
  8. from luma.led_matrix.device import max7219
  9. from luma.core.interface.serial import spi, noop
  10. from luma.core.render import canvas
  11. from luma.core.virtual import viewport
  12. from luma.core.legacy import text, show_message
  13. from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FONT, LCD_FONT
  14. # create matrix device
  15. serial = spi(port=0, device=0, gpio=noop())
  16. device = max7219(serial, cascaded=4 , block_orientation=-90, rotate=2)
  17. print("Jonty")
  18. # start demo
  19. msg = "Jonty"
  20. print(msg)
  21. show_message(device, msg, fill="white", font=proportional(CP437_FONT),scroll_delay = 0.04)
  22. time.sleep(1)
  23. with canvas(device) as draw:
  24. text(draw, (0, 0), msg, fill="white", font=proportional(LCD_FONT))