PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

46 lines
1.1KB

  1. /*
  2. This is a basic example that will print out the header and the content of an ArtDmx packet.
  3. This example uses the read() function and the different getter functions to read the data.
  4. This example may be copied under the terms of the MIT license, see the LICENSE file for details
  5. */
  6. #include <Artnet.h>
  7. #include <Ethernet.h>
  8. #include <EthernetUdp.h>
  9. #include <SPI.h>
  10. Artnet artnet;
  11. // Change ip and mac address for your setup
  12. byte ip[] = {192, 168, 2, 2};
  13. byte mac[] = {0x04, 0xE9, 0xE5, 0x00, 0x69, 0xEC};
  14. void setup()
  15. {
  16. Serial.begin(115200);
  17. artnet.begin(mac, ip);
  18. }
  19. void loop()
  20. {
  21. if (artnet.read() == ART_DMX)
  22. {
  23. // print out our data
  24. Serial.print("universe number = ");
  25. Serial.print(artnet.getUniverse());
  26. Serial.print("\tdata length = ");
  27. Serial.print(artnet.getLength());
  28. Serial.print("\tsequence n0. = ");
  29. Serial.println(artnet.getSequence());
  30. Serial.print("DMX data: ");
  31. for (int i = 0 ; i < artnet.getLength() ; i++)
  32. {
  33. Serial.print(artnet.getDmxFrame()[i]);
  34. Serial.print(" ");
  35. }
  36. Serial.println();
  37. Serial.println();
  38. }
  39. }