Question about grouping WS2812B LEDS. Right now i am working with a small 5x5 LED matrix arranged in a horizontal snake pattern starting at the top left (See picture bellow). What i would like to do is display small animations/ pixel art onto the matrix. For instance if i wanted to display the letter “X” on the matrix I would simply write it as
void loop() {
leds[6] = CRGB:: Red;
leds[8] = CRGB:: Red;
leds[12] = CRGB:: Red;
leds[16] = CRGB:: Red;
leds[18] = CRGB:: Red;
FastLED.show();
FastLED.delay(10);
}
What i am wondering is if there is a way to simplify this code so that i don’t have to manually assigning each led. Is it possible to group these Leds into their own array and then assign that array to the color Red?
It might be daunting at first if this is your your first WS2812 matrix project, but it might be worth taking a crack at: There are a few font libraries that you can add - so that you can have a function that you pass a character to, and it will return a matrix (in this example 6x9) with the proper pixels illuminated to make the character. Of course, this particular library needs a bigger matrix than your 5x5
But if you don’t want to get complicated, I think you just want to ask if you can assign an array of indexes… you should be able to do that.
int letterx[5] = {6,8,12,16,18};
FastLED.clear();
for(int i =0; i<5;i++){
leds[letterx[i]] = CRGB::Red;
}