mote
mote copied to clipboard
Anybody using WebSerial to talk from a web page to a mote?
Did anybody attempted that or know someone that did?
I guess that by understanding the protocol, it should be possible to do the same thing as this:
self.port.write(b'o')
self.port.write(buf)```
But in javascript...
This should be possible, yes.
The protocol is not very complicated.
Channel configuration consists of eight bytes, starting with motec followed by the channel number, followed by the number of pixels, followed by the channel flags- currently only values 1 and 0 are supported to enable/disable gamma correction.
There are a maximum of four channels with sixteen LEDs so most of the time you just want to send:
b'motec\x00\x10\x01'
b'motec\x01\x10\x01'
b'motec\x02\x10\x01'
b'motec\x03\x10\x01'
Then updating a channel consists of 54 bytes (assuming 16 LEDs). motec followed by the channel number, followed by the RGB triplets for each pixel.
b'moteo\x00\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@\xff\x80@'