Web
Web-Interface for the display.
Start with
$ flask –app web.py run –host=0.0.0.0
Use FLASK_ENV=development for a development server.
The webserver provides an address at location ‘/px/<x>/<y>/<on or off>’ with coordinate values for <x> and <y> and a status value for <on or off> which must “on” or “off”. You can send a GET or POST request to this addres.
For instance to turn pixel at location (2,3) on you can use
$ curl HOSTNAME/px/2/3/on
Route /page can be read with method GET or changed with method POST.
/page (GET) returns a list of 1s and 0s that represent the current display.
/page (POST) expects a parameter data of 1s and 0s to change the current display. Entries with x are ignored and allow for partial updates of the display.
/display (GET) returns the current display as JSON.
/display (POST) expects a JSON with a single image or a list of images to display. Each image is a dictionary with the keys “pixels” and “duration_ms”. The value of “pixels” is a string of 0s and 1s. The value of “duration_ms” is the duration of the image in milliseconds. For instance:
{
"images": [
{
"pixels": "000011x0...", # values of x are ignored
"duration_ms": 1000
},
...
]
}
To show text, send a json with the text:
{
"text": "Hello World",
"scrolling": true, (optional, default false)
"fps": 10, (optional, default 10)
"duration_ms": 1000 (optional, default 1000)
}
- web.route_display_post()[source]
Send a new display. Expecting json of the form:
{ "pixels": "00001100..." }
To send a sequence of images, send a list of images including duration in ms:
{ "images": [ { "pixels": "00001100...", "duration_ms": 1000 }, ... ] }
To show text, send a json with the text:
{ "text": "Hello World", "scrolling": true, (optional, default false) "fps": 10, (optional, default 10) "duration_ms": 1000 (optional, default 1000) }
To set the led brightness, send a json with the led value:
{ "led": "on" # or "off" }