No description
| 3d-print | ||
| images | ||
| lib | ||
| scenes | ||
| .gitignore | ||
| main.py | ||
| matrix.service | ||
| README.md | ||
Zutaten
- LED-Matrix-Panel(s) von Joy-IT mit Hat für den Raspi
- Raspberry Pi 4
- https://github.com/hzeller/rpi-rgb-led-matrix
Benutzung
- als root ausführen
- gunicorn -b 0.0.0.0 -w 1 -k gthread main:app
Beim Booten starten
- Kopiere die systemd/matrix.service nach /etc/systemd/service/
- systemctl daemon-reload
- systemctl enable --now matrix
Dateien
- main.py (das Hauptprogramm und der Flask-Webserver)
- lib/display.py (LED-Matrix konfigurieren und ansteuern)
- scenes/ (verschiede Darstellungsmodi)
Architektur
Die "main.py" beinhaltet eine Flask-Web-Anwendung. Darüber lässt sich das Programm mit HTTP-Anfragen steuern.
Beim Starten werden alle Dateien aus dem scenes-Verzeichnis geladen. Eine Szene lässt sich über http://raspi:8000/start/NAME-DER-SZENE starten. Die Szene läuft dann als Thread parallel zur Web-Anwendung.
./main.py curl http://localhost:6000/start/helloworld feh --reload 0.15 image.png
https://pypi.org/project/finnhub-python/
Locale
Für deutsche Ausgabe (z.B. den Monatsnamen):
- als root:
dpkg-reconfigure locales - de_DE.UTF-8 aktivieren
Szenen
- curl "http://localhost:8000/start/color?red=255&green=255&blue=255"
- curl http://localhost:8000/start/bitcoin
- curl http://localhost:8000/start/clock
- curl http://localhost:8000/start/colorclock
- curl http://localhost:8000/start/helloworld
- curl http://localhost:8000/start/scroll
- curl http://localhost:8000/start/piamedia
- curl http://localhost:8000/stop
- curl http://localhost:8000/reset
Entwicklung ohne Matrix-Display
Falls man Szenen entwickeln möchte, aber das Matrix-Display nicht zur Hand hat, kann man die Bild-Ausgabe auch in eine Datei schreiben:
- lib/display.py -> dev = True
- ./main.py
- feh --auto-reload image.png