Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Artnet.h>
- #include <Ethernet.h>
- #include <EthernetUdp.h>
- #include <SPI.h>
- #include <DmxSimple.h>
- // Configurações
- byte ip[] = {192, 168, 0, 90};
- byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};
- const int universo = 0;
- int dmxpin = 5;
- int W5100_RESET_PIN = 3;
- Artnet artnet;
- int d =1;
- void setup()
- {
- pinMode(W5100_RESET_PIN, OUTPUT);
- digitalWrite(W5100_RESET_PIN, LOW);
- delay(100);
- digitalWrite(W5100_RESET_PIN, HIGH);
- delay(1000);
- DmxSimple.usePin(dmxpin);
- // Serial.begin(115200);
- artnet.begin(mac, ip);
- artnet.setArtDmxCallback(onDmxFrame);
- while(d < 513){
- DmxSimple.write (d,0);
- d = d+1;
- }
- d=1;
- }
- void loop()
- {
- artnet.read();
- }
- void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
- {
- if (universe == universo){
- for (int i = 0; i < 512; i++)
- {
- DmxSimple.write(d,data[i]);
- // Serial.print ("universo - ");
- // Serial.print (universe);
- // Serial.print (" - canal ");
- // Serial.print (d);
- // Serial.print (" - valor ");
- // Serial.println (data[i]);
- d = d+1;
- }
- d=1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement