NeoPixelMosaicDump.ino 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. //----------------------------------------------------------------------
  2. // NeoPixelMosaicDump
  3. // This will dump to the serial output a grid map of the defined mosaic
  4. // The output is displayed as row column labeled grid with the NeoPixelBus
  5. // index of the pixel at the intersection of the row and column.
  6. //
  7. // To help with physical layout, there maybe included a symbol following the index
  8. // < means the index is the input index for the panel, the first on the panel
  9. // > means the index is the output index for the panel, the last on the panel
  10. //
  11. // This is useful in visualising the mosaic layout of your panels to
  12. // confirm you have them correctly wired together for this mosaic pattern
  13. //
  14. // It does not require that you have the actual panel connected
  15. //----------------------------------------------------------------------
  16. #include <NeoPixelAnimator.h>
  17. #include <NeoPixelBus.h>
  18. // uncomment one of these that matches your panel pixel layouts
  19. // rotation is ignored for mosaic as it applies a rotation for you
  20. // that is specific to the location of the panel within the mosaic
  21. // to reduce connection lengths
  22. typedef ColumnMajorAlternatingLayout MyPanelLayout;
  23. // typedef ColumnMajorLayout MyPanelLayout;
  24. // typedef RowMajorAlternatingLayout MyPanelLayout;
  25. // typedef RowMajorLayout MyPanelLayout;
  26. // make sure to set these panel and tile layout to match your sizes
  27. const uint8_t PanelWidth = 8; // a 8 pixel x 8 pixel matrix of leds on the panel
  28. const uint8_t PanelHeight = 8;
  29. const uint8_t TileWidth = 4; // laid out in 4 panels x 2 panels mosaic
  30. const uint8_t TileHeight = 2;
  31. NeoMosaic <MyPanelLayout> mosaic(
  32. PanelWidth,
  33. PanelHeight,
  34. TileWidth,
  35. TileHeight);
  36. void DumpMosaic()
  37. {
  38. Serial.println();
  39. Serial.print("\t\t");
  40. for (int x = 0; x < mosaic.getWidth(); x++)
  41. {
  42. Serial.print(x);
  43. Serial.print("\t");
  44. }
  45. Serial.println();
  46. Serial.print("\t---");
  47. for (int x = 0; x < mosaic.getWidth(); x++)
  48. {
  49. Serial.print("--------");
  50. }
  51. Serial.println();
  52. for (int y = 0; y < mosaic.getHeight(); y++)
  53. {
  54. Serial.print(" ");
  55. Serial.print(y);
  56. Serial.print("\t|\t");
  57. for (int x = 0; x < mosaic.getWidth(); x++)
  58. {
  59. NeoTopologyHint hint = mosaic.TopologyHint(x, y);
  60. Serial.print(mosaic.Map(x, y));
  61. if (hint == NeoTopologyHint_FirstOnPanel)
  62. {
  63. Serial.print("<");
  64. }
  65. else if (hint == NeoTopologyHint_LastOnPanel)
  66. {
  67. Serial.print(">");
  68. }
  69. Serial.print("\t");
  70. }
  71. Serial.println();
  72. }
  73. }
  74. void setup()
  75. {
  76. Serial.begin(115200);
  77. while (!Serial); // wait for serial attach
  78. DumpMosaic();
  79. }
  80. void loop()
  81. {
  82. }