update examples #12

master
Hideaki Tai 3 years ago
parent 4e092ca134
commit 1e3294392e

@ -6,7 +6,7 @@ const IPAddress ip(192, 168, 0, 201);
uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB};
ArtnetReceiver artnet; ArtnetReceiver artnet;
uint32_t universe = 1; uint8_t universe = 1; // 0 - 15
// FastLED // FastLED
#define NUM_LEDS 1 #define NUM_LEDS 1
@ -21,6 +21,8 @@ void setup() {
Ethernet.begin(mac, ip); Ethernet.begin(mac, ip);
artnet.begin(); 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 // if Artnet packet comes to this universe, forward them to fastled directly
artnet.forward(universe, leds, NUM_LEDS); artnet.forward(universe, leds, NUM_LEDS);

@ -5,8 +5,8 @@ const IPAddress ip(192, 168, 0, 201);
uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB}; uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB};
ArtnetReceiver artnet; ArtnetReceiver artnet;
uint32_t universe1 = 1; uint32_t universe1 = 1; // 0 - 15
uint32_t universe2 = 2; uint32_t universe2 = 2; // 0 - 15
void callback(const uint8_t* data, const uint16_t size) { void callback(const uint8_t* data, const uint16_t size) {
// you can also use pre-defined callbacks // you can also use pre-defined callbacks
@ -17,6 +17,8 @@ void setup() {
Ethernet.begin(mac, ip); Ethernet.begin(mac, ip);
artnet.begin(); 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 // if Artnet packet comes to this universe, this function is called
artnet.subscribe(universe1, [&](const uint8_t* data, const uint16_t size) { artnet.subscribe(universe1, [&](const uint8_t* data, const uint16_t size) {

@ -10,7 +10,7 @@ uint8_t mac[] = {0x01, 0x23, 0x45, 0x67, 0x89, 0xAB};
Artnet artnet; Artnet artnet;
const String target_ip = "192.168.0.200"; const String target_ip = "192.168.0.200";
uint32_t universe = 1; uint8_t universe = 1; // 0 - 15
const uint16_t size = 512; const uint16_t size = 512;
uint8_t data[size]; uint8_t data[size];
@ -22,6 +22,8 @@ void setup() {
Ethernet.begin(mac, ip); Ethernet.begin(mac, ip);
artnet.begin(target_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"); Serial.println("set subscriber");

@ -9,7 +9,7 @@ const IPAddress gateway(192, 168, 1, 1);
const IPAddress subnet(255, 255, 255, 0); const IPAddress subnet(255, 255, 255, 0);
ArtnetWiFiReceiver artnet; ArtnetWiFiReceiver artnet;
uint32_t universe = 1; uint8_t universe = 1; // 0 - 15
// FastLED // FastLED
#define NUM_LEDS 1 #define NUM_LEDS 1
@ -33,6 +33,8 @@ void setup() {
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
artnet.begin(); 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 // if Artnet packet comes to this universe, forward them to fastled directly
artnet.forward(universe, leds, NUM_LEDS); artnet.forward(universe, leds, NUM_LEDS);

@ -8,8 +8,8 @@ const IPAddress gateway(192, 168, 1, 1);
const IPAddress subnet(255, 255, 255, 0); const IPAddress subnet(255, 255, 255, 0);
ArtnetWiFiReceiver artnet; ArtnetWiFiReceiver artnet;
uint32_t universe1 = 1; uint8_t universe1 = 1; // 0 - 15
uint32_t universe2 = 2; uint8_t universe2 = 2; // 0 - 15
void callback(const uint8_t* data, const uint16_t size) { void callback(const uint8_t* data, const uint16_t size) {
// you can also use pre-defined callbacks // you can also use pre-defined callbacks
@ -29,6 +29,8 @@ void setup() {
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
artnet.begin(); 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 // if Artnet packet comes to this universe, this function (lambda) is called
artnet.subscribe(universe1, [&](const uint8_t* data, const uint16_t size) { artnet.subscribe(universe1, [&](const uint8_t* data, const uint16_t size) {

@ -9,7 +9,7 @@ const IPAddress subnet(255, 255, 255, 0);
ArtnetWiFi artnet; ArtnetWiFi artnet;
const String target_ip = "192.168.1.200"; const String target_ip = "192.168.1.200";
uint32_t universe = 1; uint8_t universe = 1; // 0 - 15
const uint16_t size = 512; const uint16_t size = 512;
uint8_t data[size]; uint8_t data[size];
@ -29,6 +29,8 @@ void setup() {
Serial.println(WiFi.localIP()); Serial.println(WiFi.localIP());
artnet.begin(target_ip); 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 // if Artnet packet comes to this universe, this function is called
artnet.subscribe(universe, [&](const uint8_t* data, const uint16_t size) { artnet.subscribe(universe, [&](const uint8_t* data, const uint16_t size) {

Loading…
Cancel
Save