This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Art-Net DMX
#6
(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.

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 })
Many thanks for the details. Works great. What do I need to change to control each DMX 512 Channels

(14.05.2018, 10:26)sjfp Wrote:
(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.

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 })
Many thanks for the details. Works great. What do I need to change to control each DMX 512 Channels
Found how. {value1,value2,value3) 1= Ch1 2=Ch2 3=Ch3 etc etc.
But how can I can change channels independently without affecting other channels that may of been set
Reply


Messages In This Thread
Art-Net DMX - by sjfp - 11.05.2018, 12:33
RE: Art-Net DMX - by edgars - 11.05.2018, 13:08
RE: Art-Net DMX - by sjfp - 11.05.2018, 13:20
RE: Art-Net DMX - by admin - 14.05.2018, 06:28
RE: Art-Net DMX - by Erwin van der Zwart - 14.05.2018, 07:53
RE: Art-Net DMX - by sjfp - 14.05.2018, 10:26
RE: Art-Net DMX - by admin - 14.05.2018, 11:02
RE: Art-Net DMX - by Erwin van der Zwart - 14.05.2018, 19:56
RE: Art-Net DMX - by sjfp - 21.05.2018, 17:16
RE: Art-Net DMX - by admin - 15.05.2018, 06:52
RE: Art-Net DMX - by admin - 22.05.2018, 06:00
RE: Art-Net DMX - by sjfp - 22.05.2018, 17:19
RE: Art-Net DMX - by admin - 23.05.2018, 08:35
RE: Art-Net DMX - by sjfp - 23.05.2018, 09:49
RE: Art-Net DMX - by lcrowhurst - 03.02.2020, 03:20
RE: Art-Net DMX - by admin - 03.02.2020, 11:41
RE: Art-Net DMX - by lcrowhurst - 03.02.2020, 12:15
RE: Art-Net DMX - by admin - 03.02.2020, 12:51
RE: Art-Net DMX - by lcrowhurst - 04.02.2020, 12:56
RE: Art-Net DMX - by tomnord - 07.05.2024, 12:54
RE: Art-Net DMX - by admin - 04.02.2020, 13:09
RE: Art-Net DMX - by lcrowhurst - 06.02.2020, 01:21
RE: Art-Net DMX - by lcrowhurst - 07.09.2020, 22:49
RE: Art-Net DMX - by admin - 07.05.2024, 13:07
RE: Art-Net DMX - by tomnord - 07.05.2024, 13:17
RE: Art-Net DMX - by admin - 07.05.2024, 13:20
RE: Art-Net DMX - by tomnord - 07.05.2024, 13:21
RE: Art-Net DMX - by admin - 07.05.2024, 13:42

Forum Jump: