• Tutorials

    Tutorials in Scratch, C und Python erleichtern dir den Einstieg und helfen dir bei der Umsetzung kreativer Ideen.

LED Matrix

Led Matrix ansteuern mit Python am Raspberry Pi

Wie verwende ich die LED Ma­trix für Pi­xel­dar­stel­lun­gen, Lauf­schrift, ...

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  
69 except KeyboardInterrupt:
70 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  
39 except KeyboardInterrupt:
40 GPIO.cleanup()

 

Workshops

PTS Workshop Mechatronik
Coding Mikrocontroller + Elektronik

PTS Schopenhauerstrasse, November 2019

Kontakt

Raspbotics

  • Claus Zöchling
  • +436504291944
  • info[at]raspbotics.at
  • Facebook

Download

latest Image

Stand: 02.06.2019

ältere Images