Skip to content

Instantly share code, notes, and snippets.

@hputzek
Last active April 2, 2020 19:17
Show Gist options
  • Save hputzek/68575bc56dae342c8ca42334c33a509d to your computer and use it in GitHub Desktop.
Save hputzek/68575bc56dae342c8ca42334c33a509d to your computer and use it in GitHub Desktop.
potential-frame-schema.js (Pixelcrasher/pusher)
// This is a potential structure for a frame object
const exampleFrame = {
'controllerId': {
// Pixelpusher knows how to process this from the controller metadata
// alternative 1: Put each pixel in an array, if the array has length of 3
// it means RGB, if length===4 it means RGBW
'channelId': [[255,0,0], [0,0,0,255], ['more pixels here...']],
// alternative 2: send one big array of r/g/b(w) values
'channelId': [255,0,0, 0,0,0,255,'more color values here...'],
},
'controllerId': {
'channelId': [255,0,0, 0,0,0,255,'more color values here...'],
'channelId': [[255,0,0], [0,0,0,255], ['more pixels here...']],
}
}
// Idea: later on we could also have a channel type "json" which can be used to push a JSON String to
// the controller, where it can be parsed with Arduino JSON. This can be very helpful to send configuration data
// back and forth.
const exampleFrameUsingJsonChannel = {
'controllerId': {
'channelId': {
redLedOn: true,
greenLedOn: false,
bluethoothConnected: false,
rgbLed: [255,0,0]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment