|
|
|
@ -8,11 +8,12 @@ const IPAddress gateway(192, 168, 1, 1);
|
|
|
|
|
const IPAddress subnet(255, 255, 255, 0);
|
|
|
|
|
|
|
|
|
|
ArtnetWiFi artnet;
|
|
|
|
|
const String target_ip = "192.168.1.200";
|
|
|
|
|
uint32_t universe = 1;
|
|
|
|
|
|
|
|
|
|
const uint16_t size = 512;
|
|
|
|
|
uint8_t data[size];
|
|
|
|
|
uint8_t value = 0;
|
|
|
|
|
uint32_t universe = 1;
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
|
{
|
|
|
|
@ -24,14 +25,16 @@ void setup()
|
|
|
|
|
while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); }
|
|
|
|
|
Serial.print("WiFi connected, IP = "); Serial.println(WiFi.localIP());
|
|
|
|
|
|
|
|
|
|
artnet.begin("127.0.0.1"); // send to localhost
|
|
|
|
|
artnet.begin(target_ip);
|
|
|
|
|
|
|
|
|
|
// if Artnet packet comes to this universe, this function is called
|
|
|
|
|
artnet.subscribe(universe, [&](uint8_t* data, uint16_t size)
|
|
|
|
|
{
|
|
|
|
|
Serial.print("artnet data (universe : ");
|
|
|
|
|
Serial.print(universe);
|
|
|
|
|
Serial.println(") = ");
|
|
|
|
|
Serial.print(", size = ");
|
|
|
|
|
Serial.print(size);
|
|
|
|
|
Serial.print(") :");
|
|
|
|
|
for (size_t i = 0; i < size; ++i)
|
|
|
|
|
{
|
|
|
|
|
Serial.print(data[i]); Serial.print(",");
|
|
|
|
@ -51,7 +54,7 @@ void loop()
|
|
|
|
|
{
|
|
|
|
|
artnet.parse(); // check if artnet packet has come and execute callback
|
|
|
|
|
|
|
|
|
|
value = millis() % 256;
|
|
|
|
|
value = (millis() / 4) % 256;
|
|
|
|
|
memset(data, value, size);
|
|
|
|
|
|
|
|
|
|
artnet.set(universe, data, size);
|
|
|
|
|