|
|
||
|---|---|---|
| systemd | ||
| .gitignore | ||
| buttons.py | ||
| config.py | ||
| leds.py | ||
| LICENSE | ||
| main.py | ||
| mock_neopixel.py | ||
| README.md | ||
| requirements.txt | ||
lightpickrally
python einrichten
python3 -m venv .venv source .venv/bin/activate
pip install -r requirements.txt
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
sudo raspi-config
→ Interfacing Options → SPI/I2C/GPIO aktivieren falls nötig
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