//DMX stuff #include #include const int universeSize = 512; //ArtNet stuff #include ArtnetReceiver artnet; uint32_t universe0 = 0; uint32_t universe1 = 1; int artnetdata[512]; // ethernet stuff const IPAddress ip(10, 255, 255, 255); uint8_t mac[] = {0xAA, 0xDD, 0xBB, 0xAA, 0xDD, 0xBB}; //ArtNet universe0 callback void callback(uint8_t* data, uint16_t size) { for (size_t i = 0; i <= 511; ++i) { artnetdata[i] = data[i]; if (i == 0) analogWrite(30, data[i]); if (i == 1) analogWrite(8, data[i]); if (i == 2) analogWrite(9, data[i]); } } void setup() { pinMode(30, OUTPUT); pinMode(8, OUTPUT); pinMode(9, OUTPUT); pinMode(13, OUTPUT); //pinMode(7, OUTPUT); //start DMX DMX.begin(universeSize); //start ethernet Ethernet.begin(mac, ip); //start ArtNet artnet.begin(); artnet.subscribe(universe0, callback); } void loop() { //analogWrite(9, 85); if (artnet.parse()) { // check if artnet packet has come and execute callback digitalWrite(13, HIGH); } //analogWrite(9, 255); DMX.beginTransmission(); for (int i = 0; i <= 511; ++i) { DMX.write(i, artnetdata[i]); } DMX.endTransmission(); delay(20); digitalWrite(13, LOW); }