Skip to content
Michael Miller edited this page Mar 24, 2016 · 2 revisions

The NeoMosaic object is constructed with one layout "method" that provides the mapping from the 2d coordinate system to a index that the NeoPixelBus requires.

template <typename T_LAYOUT> class NeoMosaic

The T_LAYOUT will define how the pixels on an individual matrix panel are laid out. Orientation is ignored. See Layout objects for all the possible "methods".

The NeoMosaic object will use its own layout for the matrix panels, and it will rotate the panels to shorten the interconnection distance between panels.

Once you have constructed one, you can then use it map a given x,y to a index and then use this to set a pixel color.

NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
NeoMosaic <RowMajorAlternatingLayout> mosaic(
    PanelWidth,
    PanelHeight,
    TileWidth,
    TileHeight);

...
strip.SetPixelColor(mosaic.Map(4, 5), RgbColor(16,16,98));

Using the NeoPixelsMosaicDump.ino sample, the following are some example layouts.

NeoMosaic <ColumnMajorAlternatingLayout> mosaic(4, 4, 2, 2)

		0	1	2	3	4	5	6	7	
	-------------------------------------------------------------------
  0	|	0<	7	8	15>	16<	23	24	31>	
  1	|	1	6	9	14	17	22	25	30	
  2	|	2	5	10	13	18	21	26	29	
  3	|	3	4	11	12	19	20	27	28	
  4	|	60	59	52	51	44	43	36	35	
  5	|	61	58	53	50	45	42	37	34	
  6	|	62	57	54	49	46	41	38	33	
  7	|	63>	56	55	48<	47>	40	39	32<	

NeoMosaic <RowMajorLayout> mosaic(4, 4, 2, 2)

		0	1	2	3	4	5	6	7	
	-------------------------------------------------------------------
  0	|	0<	1	2	3	19	23	27	31>	
  1	|	4	5	6	7	18	22	26	30	
  2	|	8	9	10	11	17	21	25	29	
  3	|	12	13	14	15>	16<	20	24	28	
  4	|	60	56	52	48<	47>	46	45	44	
  5	|	61	57	53	49	43	42	41	40	
  6	|	62	58	54	50	39	38	37	36	
  7	|	63>	59	55	51	35	34	33	32<		

Clone this wiki locally