#include "FastLED.h"
#define NUM_LEDS 456//this is the matrix size number of leds, not actual number
#define COLOR_ORDER RGB
const int dataline = 13;
int actualLeds =272;//? How many leds do you actually have
CRGB leds[NUM_LEDS];//defines size of storage buffer for full matrix size
void setup() {
Serial.begin(115200);
LEDS.addLeds<WS2812B, dataline>(leds, NUM_LEDS);
}
int serialGlediator() {
while (!Serial.available()) {}
return Serial.read();
}
//this is a 1D array, just set out as below for easy reading
int guitarLeds[] = {6,7,
27,28,29,30,31,32,33,
50,51,52,53,54,55,56,57,58,66,67,68,69,
74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,
97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,
120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,
144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,
168,169,170,171,172,173,182,183,184,185,189,
192,193,194,195,196,197,206,207,208,209,
216,217,218,219,220,221,230,231,232,233,
240,241,242,243,244,245,254,255,256,257,
264,265,266,267,268,269,278,279,280,281,285,
288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,309,
313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,331,332,333,
337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,
361,362,363,364,365,366,367,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,
386,387,388,389,390,391,392,393,394,402,403,404,405,
411,412,413,414,415,416,417,
436,437,438,439};
char colourStore[NUM_LEDS*3]; //this will store the selected data
void loop() {
while (serialGlediator() != 1) {}
for (int x=0; x < NUM_LEDS*3; x+3) { //loop through all incoming data and put into the colourStore array
colourStore[x] = serialGlediator();//first colour byte
colourStore [x+1] = serialGlediator();//second colour byte
colourStore [x+2] = serialGlediator();//third colour byte
}
for (int i=0; i < actualLeds; i++) {//this loops through each of the actual leds, and grabs the value //for r,g,b from colourStore at the given location value (taken from guitarLeds).
leds[i].r = colourStore[guitarLeds[i*3]];
leds[i].g = colourStore[guitarLeds[i*3]+1];
leds[i].b = colourStore[guitarLeds[i*3]+2];
}
FastSPI_LED.show();
}