Try Multicast . I added it in your code , also a correction
Code:
#include <ESP8266WiFi.h>
#include <E131.h>
#include <Adafruit_NeoPixel.h>
#define NUM_PIXELS 150 /* Number of pixels */
#define UNIVERSE 1 /* Universe to listen for */
#define CHANNEL_START 1 /* Channel to start listening at */
#define NUM_PIXELS_B 150 /* Number of pixels */
#define UNIVERSE 2 /* Universe to listen for */
#define CHANNEL_START 451 /* Channel to start listening at */
#define DATA_PIN 2 /* Pixel output - GPIO 2 */
const char ssid[] = "xxx"; /* Replace with your SSID */
const char passphrase[] = "xxx"; /* Replace with your WPA2 passphrase */
E131 e131;
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_PIXELS, DATA_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel pixels_b = Adafruit_NeoPixel(NUM_PIXELS_B, DATA_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
Serial.begin(115200);
delay(10);
// Initial pin states
pinMode(DATA_PIN, OUTPUT);
digitalWrite(DATA_PIN, LOW);
/* Choose one to begin listening for E1.31 data */
// e131.begin(ssid, passphrase); /* via Unicast on the default port */
e131.beginMulticast(ssid, passphrase, (UNIVERSE)); /* via Multicast for Universe 1 */
/* Initialize output */
pixels.begin();
pixels.show();
pixels_b.begin();
pixels_b.show();
}
void loop() {
/* Parse a packet and update pixels */
if(e131.parsePacket()) {
if (e131.universe == 1) {
for (int i = 0; i < NUM_PIXELS; i++) {
int j = i * 3 + (CHANNEL_START - 1);
pixels.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
}
pixels.show();
}
if (e131.universe == 2) {
for (int i = 0; i < NUM_PIXELS_B; i++) { // I forgot the _B
int j = i * 3 + (CHANNEL_START - 451);
pixels_b.setPixelColor(i, e131.data[j], e131.data[j+1], e131.data[j+2]);
}
pixels_b.show();
}
}
}
Bookmarks