如果您的 Artnet 设备发送调查回复数据包但未收到确认,请检查以下可能的原因:
下面给出一个示例代码,展示如何正确编写 Artnet 调查回复数据包的响应代码:
void sendPollReplyPacket()
{
uint8_t packetBuffer[ARTNET_MAX_BUFFER];
uint16_t packetSize = 0;
// fill the packet buffer with the poll reply packet data
fillPollReplyPacket(packetBuffer, &packetSize);
// here we will use UDP to broadcast the packet
IPAddress ipMulti(2, 0, 0, 1); // the multicast IP address to send to
uint16_t port = ARTNET_UDP_PORT; // the UDP port to send to
// create the UDP client
WiFiUDP udpClient;
udpClient.begin(port);
// enable multicasting on the UDP client
udpClient.beginMulticast(WiFi.localIP(), ipMulti);
// send the packet
udpClient.beginPacket(ipMulti, port);
udpClient.write(packetBuffer, packetSize);
udpClient.endPacket();
// wait for the packet to be sent
delay(10);
// stop the client
udpClient.stop();
}
该代码会使用 UDP 协议向 Artnet 控制器发送调查回复数据包。请根据您的设备所需的具体响应数据进行修改。