2bbb / node-red-node-artnet

Node-RED nodes that controls lights via artnet
MIT License
4 stars 3 forks source link

How to use? #3

Open raffaeletani opened 7 years ago

raffaeletani commented 7 years ago

Can anybody get me a hint how to use this node? I'd really like to use this, but no documentation on how to input to this node is provided. Thanks in advance

2bbb commented 7 years ago

hi @raffaeletani

  1. set with array
msg = {
  payload: {
    data: [0, 0, ...] // DMX data, length <= 512
  }
}
  1. set with array and offset
msg = {
  payload: {
    data: [0, ...], // DMX data
    offset: 0 // offset < 512, offset + data.length < 512
  }
}
  1. set with single value
msg = {
  payload: {
    address: 1, // 0 <= address < 512
    value: 255 // 0 <= value < 256
  }
}
  1. set with multiple values
msg = {
  payload: {
    buckets: [{address: 0, value: 255}, {address: 4, value: 0}, ...]
  }
}

i will write formal documents in README.md...

raffaeletani commented 7 years ago

Thank you for the explanations!

As i see, the addressing is zero indexed, so DMX channel 2 is address : 1. This gets really confusing in big installations. Any intention to change this, so the addressing corresponds to the DMX channel number?

Greetings

raffaeletani commented 7 years ago

It'll actually just need this change:

this.set = function(address, value) { this.data[address-1] = value; };