idoodler
idoodler

Reputation: 3545

Neopixel matrix with holes

I want to create a wearable LED Matrix face mask out of Neopixel LED stripes. However I need to compensate add holes for my eyes. How can I add holes in a matrix with the Adafruit_NeoMatrix Arduino Library.

Here is my matrix, 1 represents an LED, 0 represents a missing LED. I use a zigzag pattern starting from the top right moving from right to left, then down, then left to right and so on...

    [
        0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0,
        1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
        0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0
    ]

I thought I could somehow use this array as a mask.

Upvotes: 0

Views: 109

Answers (1)

Systembolaget
Systembolaget

Reputation: 2514

Use the FastLED library found here and read how to switch LEDs on or off and then use the basic approach below.

uint8_t myPattern[] = {1,2,3,4,5,21,22,23,24,25,71,72,73,74,75}; // 15 LEDs ("pixels")

myPatternLength = 15;

for(uint8_t i=0; i < myPatternLength ; i++)
{
  leds[myPattern[i]] = CHSV(255,255,255); // The 15 LEDs ("pixels") will be white
}

FastLED.show();

Upvotes: 0

Related Questions