Hello! I need some help combining Ethernet.h, sACN.h and Fastled.h
Im using an Arduino Uno with an Unofficial ethernet shield.
I have a ledstrip (WS2812B) connected to pin 4. and ground from the board to the strip.
When I try to receive sACN data (dmx) over ethernet, everything works as it should.
when I try to light up some leds, everything works as it should.
But...
When I combine both codes, as soon as I add the leds in void setup, the sacn input is gone.
Something is not going along nicely, but I have no idea what!? please help!
Here is the code:
#include "Ethernet.h"
#include "sACN.h"
#include "FastLED.h"
//Setup Ethernet
uint8_t mac[] = {0x90, 0xA2, 0xDA, 0x10, 0x14, 0x48}; // MAC Adress of your device
IPAddress ip(169, 254, 89, 67); // IP
IPAddress dns(169, 254, 89, 1); // IP
IPAddress gateway(169, 254, 89, 1); // IP
IPAddress subnet(255, 255, 0, 0); //
//Setup sACN
EthernetUDP sacn;
Receiver recv(sacn);
//Setup LEDs
const int DATA_PIN= 4;
const int NUM_LEDS= 5;
CRGB Led[NUM_LEDS];
//Array for input channels
int Channel[36] = {1,2,3,4,5,};
//Array for storing DMX values
int DMX[36];
// Define Colours
#define On 0,127,0
#define Off 127,0,0
void setup() {
Serial.begin(9600);
delay(2000);
Ethernet.begin(mac, ip, dns, gateway, subnet);
recv.begin(32); //Set Universe Here!
Serial.println("sACN start");
FastLED.addLeds<WS2812B, DATA_PIN> (Led, NUM_LEDS);
FastLED.clear(true);
}
void loop() {
//Read DMX
recv.update();
for (int i=0; i<5; i++){
DMX[i] = (recv.dmx(Channel[i]));
// Print to serial for visualisation
Serial.print(i);
Serial.print("= ");
Serial.println(DMX[i]);
}
delay(1000);
}