Advertisement
NapsterMP3

Artnet para Serial print

Aug 31st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. #include <Artnet.h>
  2. #include <Ethernet.h>
  3. #include <EthernetUdp.h>
  4. #include <SPI.h>
  5. //#include <DmxSimple.h>
  6.  
  7. // Configurações
  8. byte ip[] = {192, 168, 0, 90};
  9. byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};
  10. const int universo = 0;
  11. //int dmxpin = 5;
  12. //int W5100_RESET_PIN = 3;
  13.  
  14. Artnet artnet;
  15. int d =1;
  16. void setup()
  17. {
  18. //pinMode(W5100_RESET_PIN, OUTPUT);
  19. // digitalWrite(W5100_RESET_PIN, LOW);
  20. // delay(100);
  21. // digitalWrite(W5100_RESET_PIN, HIGH);
  22. //
  23. // delay(1000);
  24.  
  25. // DmxSimple.usePin(dmxpin);
  26. // Serial.begin(115200);
  27. artnet.begin(mac, ip);
  28. artnet.setArtDmxCallback(onDmxFrame);
  29. //while(d < 513){
  30. // DmxSimple.write (d,0);
  31. // d = d+1;
  32. //}
  33. //d=1;
  34. }
  35.  
  36. void loop()
  37. {
  38. artnet.read();
  39. }
  40.  
  41. void onDmxFrame(uint16_t universe, uint16_t length, uint8_t sequence, uint8_t* data)
  42. {
  43. if (universe == universo){
  44. for (int i = 0; i < 512; i++)
  45. {
  46. //DmxSimple.write(d,data[i]);
  47. Serial.print ("universo - ");
  48. Serial.print (universe);
  49. Serial.print (" - canal ");
  50. Serial.print (d);
  51. Serial.print (" - valor ");
  52. Serial.println (data[i]);
  53. d = d+1;
  54. }
  55. d=1;
  56. }
  57.  
  58.  
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement