From 1e3294392e25389369eb43d9fc7fafb6330376fd Mon Sep 17 00:00:00 2001 From: Hideaki Tai Date: Sat, 2 Jan 2021 00:43:10 +0900 Subject: [PATCH] update examples #12 --- examples/Ethernet/receive_fastled/receive_fastled.ino | 4 +++- examples/Ethernet/receiver/receiver.ino | 6 ++++-- examples/Ethernet/send_receive/send_receive.ino | 4 +++- examples/WiFi/receive_fastled/receive_fastled.ino | 4 +++- examples/WiFi/receiver/receiver.ino | 6 ++++-- examples/WiFi/send_receive/send_receive.ino | 4 +++- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/examples/Ethernet/receive_fastled/receive_fastled.ino b/examples/Ethernet/receive_fastled/receive_fastled.ino index 99ab0d2..d439e89 100644 --- a/examples/Ethernet/receive_fastled/receive_fastled.ino +++ b/examples/Ethernet/receive_fastled/receive_fastled.ino @@ -6,7 +6,7 @@ const IPAddress ip(192, 168, 0, 201); uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; ArtnetReceiver artnet; -uint32_t universe = 1; +uint8_t universe = 1; // 0 - 15 // FastLED #define NUM_LEDS 1 @@ -21,6 +21,8 @@ void setup() { Ethernet.begin(mac, ip); artnet.begin(); + // artnet.subscribe_net(0); // optionally you can change + // artnet.subscribe_subnet(0); // optionally you can change // if Artnet packet comes to this universe, forward them to fastled directly artnet.forward(universe, leds, NUM_LEDS); diff --git a/examples/Ethernet/receiver/receiver.ino b/examples/Ethernet/receiver/receiver.ino index 192a1c3..31f7f2a 100644 --- a/examples/Ethernet/receiver/receiver.ino +++ b/examples/Ethernet/receiver/receiver.ino @@ -5,8 +5,8 @@ const IPAddress ip(192, 168, 0, 201); uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; ArtnetReceiver artnet; -uint32_t universe1 = 1; -uint32_t universe2 = 2; +uint32_t universe1 = 1; // 0 - 15 +uint32_t universe2 = 2; // 0 - 15 void callback(const uint8_t* data, const uint16_t size) { // you can also use pre-defined callbacks @@ -17,6 +17,8 @@ void setup() { Ethernet.begin(mac, ip); artnet.begin(); + // artnet.subscribe_net(0); // optionally you can change + // artnet.subscribe_subnet(0); // optionally you can change // if Artnet packet comes to this universe, this function is called artnet.subscribe(universe1, [&](const uint8_t* data, const uint16_t size) { diff --git a/examples/Ethernet/send_receive/send_receive.ino b/examples/Ethernet/send_receive/send_receive.ino index 91324c8..702cd0c 100644 --- a/examples/Ethernet/send_receive/send_receive.ino +++ b/examples/Ethernet/send_receive/send_receive.ino @@ -10,7 +10,7 @@ uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; Artnet artnet; const String target_ip = "192.168.0.200"; -uint32_t universe = 1; +uint8_t universe = 1; // 0 - 15 const uint16_t size = 512; uint8_t data[size]; @@ -22,6 +22,8 @@ void setup() { Ethernet.begin(mac, ip); artnet.begin(target_ip); + // artnet.subscribe_net(0); // optionally you can change + // artnet.subscribe_subnet(0); // optionally you can change Serial.println("set subscriber"); diff --git a/examples/WiFi/receive_fastled/receive_fastled.ino b/examples/WiFi/receive_fastled/receive_fastled.ino index a43b446..47fc6b5 100644 --- a/examples/WiFi/receive_fastled/receive_fastled.ino +++ b/examples/WiFi/receive_fastled/receive_fastled.ino @@ -9,7 +9,7 @@ const IPAddress gateway(192, 168, 1, 1); const IPAddress subnet(255, 255, 255, 0); ArtnetWiFiReceiver artnet; -uint32_t universe = 1; +uint8_t universe = 1; // 0 - 15 // FastLED #define NUM_LEDS 1 @@ -33,6 +33,8 @@ void setup() { Serial.println(WiFi.localIP()); artnet.begin(); + // artnet.subscribe_net(0); // optionally you can change + // artnet.subscribe_subnet(0); // optionally you can change // if Artnet packet comes to this universe, forward them to fastled directly artnet.forward(universe, leds, NUM_LEDS); diff --git a/examples/WiFi/receiver/receiver.ino b/examples/WiFi/receiver/receiver.ino index 265543c..774affe 100644 --- a/examples/WiFi/receiver/receiver.ino +++ b/examples/WiFi/receiver/receiver.ino @@ -8,8 +8,8 @@ const IPAddress gateway(192, 168, 1, 1); const IPAddress subnet(255, 255, 255, 0); ArtnetWiFiReceiver artnet; -uint32_t universe1 = 1; -uint32_t universe2 = 2; +uint8_t universe1 = 1; // 0 - 15 +uint8_t universe2 = 2; // 0 - 15 void callback(const uint8_t* data, const uint16_t size) { // you can also use pre-defined callbacks @@ -29,6 +29,8 @@ void setup() { Serial.println(WiFi.localIP()); artnet.begin(); + // artnet.subscribe_net(0); // optionally you can change + // artnet.subscribe_subnet(0); // optionally you can change // if Artnet packet comes to this universe, this function (lambda) is called artnet.subscribe(universe1, [&](const uint8_t* data, const uint16_t size) { diff --git a/examples/WiFi/send_receive/send_receive.ino b/examples/WiFi/send_receive/send_receive.ino index 3db4183..643326d 100644 --- a/examples/WiFi/send_receive/send_receive.ino +++ b/examples/WiFi/send_receive/send_receive.ino @@ -9,7 +9,7 @@ const IPAddress subnet(255, 255, 255, 0); ArtnetWiFi artnet; const String target_ip = "192.168.1.200"; -uint32_t universe = 1; +uint8_t universe = 1; // 0 - 15 const uint16_t size = 512; uint8_t data[size]; @@ -29,6 +29,8 @@ void setup() { Serial.println(WiFi.localIP()); artnet.begin(target_ip); + // artnet.subscribe_net(0); // optionally you can change + // artnet.subscribe_subnet(0); // optionally you can change // if Artnet packet comes to this universe, this function is called artnet.subscribe(universe, [&](const uint8_t* data, const uint16_t size) {