(14.05.2018, 06:28)admin Wrote: Here's a simplified function. Change universe number as needed, sequence and physical parameters can probably be zero. Value is the output channel value ranging from 0 to 255.Many thanks for the details. Works great. What do I need to change to control each DMX 512 Channels
Code:function artnet_dmx(ip, sequence, physical, universe, data) local cmd = string.char( -- null byte 0, -- ARTNET_DMX opcope 0, 0x50, -- protocol version 14 0, 14, -- sequence number is used to ensure that ArtDmx packets are used in the correct order bit.band(sequence, 0xFF), -- physical input port from which DMX512 data was input. bit.band(physical, 0xFF), -- 15 bit Port-Address (universe) bit.band(universe, 0xFF), bit.rshift(universe, 8), -- Length bit.rshift(#data, 8), bit.band(#data, 0xFF) ) local req = "Art-Net" .. cmd .. string.char(unpack(data)) local sck = require("socket").udp() sck:sendto(req, ip, 0x1936) sck:close() end ip = '192.168.2.43' universe = 123 value = 255 artnet_dmx(ip, 0, 0, universe, { value })
(14.05.2018, 10:26)sjfp Wrote:Found how. {value1,value2,value3) 1= Ch1 2=Ch2 3=Ch3 etc etc.(14.05.2018, 06:28)admin Wrote: Here's a simplified function. Change universe number as needed, sequence and physical parameters can probably be zero. Value is the output channel value ranging from 0 to 255.Many thanks for the details. Works great. What do I need to change to control each DMX 512 Channels
Code:function artnet_dmx(ip, sequence, physical, universe, data) local cmd = string.char( -- null byte 0, -- ARTNET_DMX opcope 0, 0x50, -- protocol version 14 0, 14, -- sequence number is used to ensure that ArtDmx packets are used in the correct order bit.band(sequence, 0xFF), -- physical input port from which DMX512 data was input. bit.band(physical, 0xFF), -- 15 bit Port-Address (universe) bit.band(universe, 0xFF), bit.rshift(universe, 8), -- Length bit.rshift(#data, 8), bit.band(#data, 0xFF) ) local req = "Art-Net" .. cmd .. string.char(unpack(data)) local sck = require("socket").udp() sck:sendto(req, ip, 0x1936) sck:close() end ip = '192.168.2.43' universe = 123 value = 255 artnet_dmx(ip, 0, 0, universe, { value })
But how can I can change channels independently without affecting other channels that may of been set