NeoPixelTilesDump.ino 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. //----------------------------------------------------------------------
  2. // NeoPixelTileDump
  3. // This will dump to the serial output a grid map of the defined tiles
  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 tile layout of your panels to
  12. // confirm you have them correctly wired together for the defined 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 and
  19. // how you want them rotated. Not all the rotations are listed here
  20. // but you can modifiy the name to include the rotation of 90,180, or 270.
  21. typedef ColumnMajorAlternatingLayout MyPanelLayout;
  22. // typedef ColumnMajorLayout MyPanelLayout;
  23. // typedef RowMajorAlternatingLayout MyPanelLayout;
  24. // typedef RowMajorLayout MyPanelLayout;
  25. // typedef RowMajor90Layout MyPanelLayout; // note rotation 90 was used
  26. // change this to be one of the layouts which will define the layout
  27. // of the panels themselves
  28. typedef ColumnMajorLayout MyTilesLayout;
  29. // make sure to set these panel and tile layout to match your sizes
  30. const uint8_t PanelWidth = 8; // 8 pixel x 8 pixel matrix of leds
  31. const uint8_t PanelHeight = 8;
  32. const uint8_t TileWidth = 4; // laid out in 4 panels x 2 panels mosaic
  33. const uint8_t TileHeight = 2;
  34. NeoTiles <MyPanelLayout, MyTilesLayout> tiles(
  35. PanelWidth,
  36. PanelHeight,
  37. TileWidth,
  38. TileHeight);
  39. void DumpTopo()
  40. {
  41. Serial.println();
  42. Serial.print("\t\t");
  43. for (int x = 0; x < tiles.getWidth(); x++)
  44. {
  45. Serial.print(x);
  46. Serial.print("\t");
  47. }
  48. Serial.println();
  49. Serial.print("\t---");
  50. for (int x = 0; x < tiles.getWidth(); x++)
  51. {
  52. Serial.print("--------");
  53. }
  54. Serial.println();
  55. for (int y = 0; y < tiles.getHeight(); y++)
  56. {
  57. Serial.print(" ");
  58. Serial.print(y);
  59. Serial.print("\t|\t");
  60. for (int x = 0; x < tiles.getWidth(); x++)
  61. {
  62. NeoTopologyHint hint = tiles.TopologyHint(x, y);
  63. Serial.print(tiles.Map(x, y));
  64. if (hint == NeoTopologyHint_FirstOnPanel)
  65. {
  66. Serial.print("<");
  67. }
  68. else if (hint == NeoTopologyHint_LastOnPanel)
  69. {
  70. Serial.print(">");
  71. }
  72. Serial.print("\t");
  73. }
  74. Serial.println();
  75. }
  76. }
  77. void setup()
  78. {
  79. Serial.begin(115200);
  80. while (!Serial); // wait for serial attach
  81. DumpTopo();
  82. }
  83. void loop()
  84. {
  85. }