Hi Gamemap!
If you want to debug your Artnet trame I recomand you to use Wireshark.

If you want to get a from an poolbytearray do like for an array
var OPCodes = packet[9] # In reality it is two bytes, number 8 (0x00) & 9( 0x50)
print("OPCodes: %x" % OPCodes) # Use "%x" % to print ax hexadecimal
# OPCodes: 50
If you want to get all the 512 dmx values, use:
DMX = packet.subarray(18,529) # Packet.size() = 530 bytes
Here is an complete example. I don't check Artnet version or univers. It is not really complex to do.
extends Node
const ARTNET_PORT = 6454
var artnetRX: PacketPeerUDP = PacketPeerUDP.new()
var DMX = []
# Set the PacketPeerUDP to listener the ARTNET_PORT (6454)
func _ready():
print("start")
if (artnetRX.listen(ARTNET_PORT) != OK):
print("Error listening to port: ", ARTNET_PORT)
else:
print("Listening to port: " , ARTNET_PORT)
# Check at each frame if received a udp ARTNET packet at ARTNET_PORT
# You can set physics process at 40 Hz or use _process()
func _physics_process(delta):
if artnetRX.get_available_packet_count() > 0:
var packet = artnetRX.get_packet()
print("Receive Artnet trame, len: ", packet.size())
# Should be 530, 18 bytes of Artnet identifier and 512 bytes of values.
var OPCodes = packet[9] # In reality it is two bytes,
#number 8 & 9
print("OPCodes: %x" % OPCodes) # Use "%x" % to print ax hexadecimal
DMX = packet.subarray(18,529) # See PoolByteArray class
print("CH1 = ", DMX[0],", CH2 = ", DMX[1],", CH7 = ", DMX[6],", CH8 = ", DMX[7])
# Here to get your values as an array.
This example will print:
Receive Artnet trame, len: 530
OPCodes: 50
CH1 = 255, CH2 = 255, CH7 = 255, CH8 = 0
Regards, Foreman21.