https://github.com/kizzycode/ws2812b-cgi-rust
A tiny CGI application which to bridge JSON update requests to a WS2812B serial driver
https://github.com/kizzycode/ws2812b-cgi-rust
Last synced: 9 months ago
JSON representation
A tiny CGI application which to bridge JSON update requests to a WS2812B serial driver
- Host: GitHub
- URL: https://github.com/kizzycode/ws2812b-cgi-rust
- Owner: KizzyCode
- Created: 2023-10-07T23:25:48.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-10T17:55:53.000Z (about 2 years ago)
- Last Synced: 2025-02-06T04:44:16.359Z (11 months ago)
- Language: Rust
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE BSD 2-CLAUSE.md
Awesome Lists containing this project
README
[](https://opensource.org/licenses/BSD-2-Clause)
[](https://opensource.org/licenses/MIT)
[](https://ci.appveyor.com/project/KizzyCode/Ws2812b-cgi-rust)
# `ws2812b-cgi`
Welcome to `ws2812b-cgi` 🎉
This application is a tiny (CGI) application which reads a JSON array with update commands from `stdin`, translates them
into [WS2812B driver commands](https://github.com/KizzyCode/WS2812BDriver-rust-rp2040), and sends them to the driver's
serial port.
## Configuration
Due to configuration limits in a CGI environment, the configuration is set during compilation via the following
environment variables:
- `WS2812B_CGI_SERIALDEVICE`: The path to the serial device (defaults to `/dev/ws2812b.serial`)
- `WS2812B_CGI_TIMEOUT`: The timeout for a CGI process in seconds, used for the internal watchdog (defaults to 10
seconds)
## Example
Change the 0th pixel of the 0th strip to white (RGBW 255,255,255,0):
```sh
echo '[{ "strip": 0, "pixel": 0, "rgbw": [255,255,255,0] }]' | ws2812b
```
## Docker
The docker image uses `/dev/ws2812b.serial` as serial device path - you can simply mount your real device onto this
path. Please note, that the `docker-compose.yml` is an example and must be adapted to your specific setup.