LED Matrix
Wie verwende ich die LED Matrix für Pixeldarstellungen, Laufschrift, ...
In diesem Tutorial lernst du die Verwendung der LED Matrix, um Laufschriften zu erzeugen bzw. eigene Pixel und Bilder zu zeichnen.
Erzeugen von Laufschriften
1 | import sys |
2 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module/RFID') |
3 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module/LED_Matrix') |
4 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module') |
5 | from RPi import GPIO |
6 | GPIO.setmode(GPIO.BCM) |
7 | import time |
8 | import LEDMatrix |
9 | from LEDMatrix import * |
10 | |
11 | LEDMatrix.init() |
12 | LEDMatrix.brightness(15) |
13 | LEDMatrix.richtung = 0 |
14 | |
48 | try: |
49 | while 1: |
50 | LEDMatrix.Scroll(["Raspbotics"],0.05,Left) |
67 | time.sleep(3) |
68 | |
15 | except KeyboardInterrupt: |
16 | GPIO.cleanup() |
Erzeugen von Pixelgrafiken
1 | import sys |
2 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module/RFID') |
3 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module/LED_Matrix') |
4 | sys.path.append('/home/pi/raspbotics/Pythonboard_Module') |
5 | from RPi import GPIO |
6 | GPIO.setmode(GPIO.BCM) |
7 | import time |
8 | import LEDMatrix |
9 | from LEDMatrix import * |
10 | |
11 | LEDMatrix.init() |
12 | LEDMatrix.brightness(15) |
13 | LEDMatrix.richtung = 0 |
14 | |
15 | Bild1 = [[0,1,1,0,0,1,1,0], |
16 | [0,1,1,0,0,1,1,0], |
17 | [0,0,0,0,0,0,0,0], |
18 | [0,0,0,1,1,0,0,0], |
19 | [0,0,0,1,1,0,0,0], |
20 | [0,0,0,0,0,0,0,1], |
21 | [0,1,0,0,0,0,1,0], |
22 | [0,0,1,1,1,1,0,0] ] |
23 | |
24 | Bild2 = [[0,1,1,0,0,1,1,0], |
25 | [0,1,1,0,0,1,1,0], |
26 | [0,0,0,0,0,0,0,0], |
27 | [0,0,0,1,1,0,0,0], |
28 | [0,0,0,1,1,0,0,0], |
29 | [0,0,0,0,0,0,0,0], |
30 | [0,0,1,1,1,1,0,0], |
31 | [0,1,0,0,0,0,1,0] ] |
32 | try: |
33 | while 1: |
34 | LEDMatrix.Display(Bild1) |
35 | time.sleep(1) |
36 | LEDMatrix.Display(Bild2) |
37 | time.sleep(1) |
38 | |
15 | except KeyboardInterrupt: |
16 | GPIO.cleanup() |