|
|
@ -15,48 +15,48 @@ const uint16_t size = 512;
|
|
|
|
uint8_t data[size];
|
|
|
|
uint8_t data[size];
|
|
|
|
uint8_t value = 0;
|
|
|
|
uint8_t value = 0;
|
|
|
|
|
|
|
|
|
|
|
|
void setup()
|
|
|
|
void setup() {
|
|
|
|
{
|
|
|
|
|
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.begin(115200);
|
|
|
|
|
|
|
|
|
|
|
|
// WiFi stuff
|
|
|
|
// WiFi stuff
|
|
|
|
WiFi.begin(ssid, pwd);
|
|
|
|
WiFi.begin(ssid, pwd);
|
|
|
|
WiFi.config(ip, gateway, subnet);
|
|
|
|
WiFi.config(ip, gateway, subnet);
|
|
|
|
while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); }
|
|
|
|
while (WiFi.status() != WL_CONNECTED) {
|
|
|
|
Serial.print("WiFi connected, IP = "); Serial.println(WiFi.localIP());
|
|
|
|
Serial.print(".");
|
|
|
|
|
|
|
|
delay(500);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Serial.print("WiFi connected, IP = ");
|
|
|
|
|
|
|
|
Serial.println(WiFi.localIP());
|
|
|
|
|
|
|
|
|
|
|
|
artnet.begin(target_ip);
|
|
|
|
artnet.begin(target_ip);
|
|
|
|
|
|
|
|
|
|
|
|
// if Artnet packet comes to this universe, this function is called
|
|
|
|
// if Artnet packet comes to this universe, this function is called
|
|
|
|
artnet.subscribe(universe, [&](uint8_t* data, uint16_t size)
|
|
|
|
artnet.subscribe(universe, [&](const uint8_t* data, const uint16_t size) {
|
|
|
|
{
|
|
|
|
|
|
|
|
Serial.print("artnet data (universe : ");
|
|
|
|
Serial.print("artnet data (universe : ");
|
|
|
|
Serial.print(universe);
|
|
|
|
Serial.print(universe);
|
|
|
|
Serial.print(", size = ");
|
|
|
|
Serial.print(", size = ");
|
|
|
|
Serial.print(size);
|
|
|
|
Serial.print(size);
|
|
|
|
Serial.print(") :");
|
|
|
|
Serial.print(") :");
|
|
|
|
for (size_t i = 0; i < size; ++i)
|
|
|
|
for (size_t i = 0; i < size; ++i) {
|
|
|
|
{
|
|
|
|
Serial.print(data[i]);
|
|
|
|
Serial.print(data[i]); Serial.print(",");
|
|
|
|
Serial.print(",");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Serial.println();
|
|
|
|
Serial.println();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// if Artnet packet comes, this function is called to every universe
|
|
|
|
// if Artnet packet comes, this function is called to every universe
|
|
|
|
artnet.subscribe([&](uint32_t univ, uint8_t* data, uint16_t size)
|
|
|
|
artnet.subscribe([&](const uint32_t univ, const uint8_t* data, const uint16_t size) {
|
|
|
|
{
|
|
|
|
|
|
|
|
Serial.print("ArtNet data has come to universe: ");
|
|
|
|
Serial.print("ArtNet data has come to universe: ");
|
|
|
|
Serial.println(univ);
|
|
|
|
Serial.println(univ);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
void loop() {
|
|
|
|
{
|
|
|
|
artnet.parse(); // check if artnet packet has come and execute callback
|
|
|
|
artnet.parse(); // check if artnet packet has come and execute callback
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
value = (millis() / 4) % 256;
|
|
|
|
value = (millis() / 4) % 256;
|
|
|
|
memset(data, value, size);
|
|
|
|
memset(data, value, size);
|
|
|
|
|
|
|
|
|
|
|
|
artnet.set(universe, data, size);
|
|
|
|
artnet.set(universe, data, size);
|
|
|
|
artnet.streaming(); // automatically send set data in 40fps
|
|
|
|
artnet.streaming(); // automatically send set data in 40fps
|
|
|
|
}
|
|
|
|
}
|
|
|
|