No description
- Python 72.7%
- Go 27.3%
| systemd | ||
| ui | ||
| .gitignore | ||
| buttons.py | ||
| config.py | ||
| leds.py | ||
| LICENSE | ||
| main.py | ||
| mock_neopixel.py | ||
| neopixel_rpi_simpletest.py | ||
| README.md | ||
| requirements.txt | ||
| test_neopixel.py | ||
| test_neopixel2.py | ||
lightpickrally
Lib: https://github.com/adafruit/Adafruit_CircuitPython_NeoPixel
python einrichten
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Pins
LED-Pin: 10
config.py: Pins für die Spieler definieren
test unter linux
mit flash webserver
MOCK_LED=1 .venv/bin/python main.py
mit produktivem gunicorn webserver
MOCK_LED=1 gunicorn -b 0.0.0.0:5000 main:app
ein Segment
curl -X POST http://localhost:5000/led \
-H "Content-Type: application/json" \
-d '{
"segments": [
{ "index": 0, "count": 5, "rgb": "FF0000" }
]
}'
mehrere Segmente
curl -X POST http://localhost:5000/led \
-H "Content-Type: application/json" \
-d '{
"segments": [
{ "index": 0, "count": 5, "rgb": "FF0000" },
{ "index": 10, "count": 10, "rgb": "00FF00" },
{ "index": 30, "count": 3, "rgb": "0000FF" }
]
}'
Installation auf dem pi
sudo apt install python3-venv python3-pip git -y
# → Interfacing Options → SPI/I2C/GPIO aktivieren falls nötig
sudo raspi-config
Gehe zu Interfacing Options und dann zu SPI.
Wähle Yes, um SPI zu aktivieren.
Starte den Raspberry Pi neu.
sudo reboot
cd /home/pi
git clone https://git.swablab.de/projects/lightpickrally.git
cd lightpickrally
python3 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt
# systemd/lightserver.service nach /etc/systemd/system/lightserver.service kopieren
sudo systemctl daemon-reload
sudo systemctl enable lightserver
sudo systemctl start lightserver
sudo systemctl status lightserver
# Logs prüfen
journalctl -u lightserver -f