Hello, I’m interested in changing the config on the fly from another microcontroller through web sockets. I’m wondering if it’s possible to change the LED type and the map function.
Yes, you can set LED type and map data (and map function text) via websockets. Led type is pretty simple. Mapping is slightly more complex.
If you have a previously stored map you want to use, uploading it is straightforward. If you want to allow users (or an agent) to dynamically specify a mapping function, you’ll have to evaluate the function on your microcontroller - the Pixelblaze doesn’t run the javascript mapping functions itself.
That’s done by the WebUI, which uses the browser’s “regular” javascript (not the on-device Pixelblaze subset) to evaluate the function, then saves the resulting coordinates and source code to the device.
Anyway, for an example of how to approach this, see the functions createMapData()/setMapData() and setLedType() in the Pixelblaze client Python library here:
Thank you very much for the reply. I really appreciate that. When I looked at your client yesterday, I saw getLedType but I didn’t see setLedType. I must have missed that. I’ll go back and have another look. Doh: I see now I wasn’t really looking at your definitions too hard. I just saw the gets. I didn’t read to the end of the line and see where you have sets. Feeling pretty stupid now. Thanks for the clarification. ![]()
I have another related question. We were hoping to be able to send the same commands that we could send through web sockets but through a serial port connection. The idea there is that in our potential device we’re going to already have an ESP32, which could use web sockets to the pixelblaze but for reliability’s sake it might be nice to have a permanent dedicated channel for the two of them to communicate.
This has been talked about for a while. It’s up to @wizard! I’d like to have this feature too, even if it’s at a low bit rate.
Right now, you can hijack the sensor board serial connection & protocol to send ad-hoc commands to individual patterns, but there’s nobody listening for the system JSON commands.