Hello all! This is my first post here and I'm looking for some help getting a pattern over to my neopixel grid (WS2812B).
I've stored the pattern as a 2D array using bits (I know they are actually integers but I'm not aware of a good way of using bits in c++ yet).
My code loops through the array and assigns the leds to be either on or off in that position.
The problem is, when I upload the .ino and connect the 8x8, the pattern looks like this:
#, #, #, #, #, #, #, #
#, #, #, 0, #, 0, #, #
#, 0, #, 0, #, #, 0, 0
#, #, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
#, 0, 0, 0, 0, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
And here is the code:
#define data 6
#define numLED 64
/*
heart pattern as array:
0, #, #, 0, 0, #, #, 0
#, #, #, #, #, #, #, #
#, #, #, #, #, #, #, #
#, #, #, #, #, #, #, #
0, #, #, #, #, #, #, 0
0, 0, #, #, #, #, 0, 0
0, 0, 0, #, #, 0, 0, 0
0, 0, 0, 0, 0, 0, 0, 0
*/
int ledPattern[8][8] = {{0, 1, 1, 0, 0, 1, 1, 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}, {0, 1, 1, 1, 1, 1, 1, 0}, {0, 0, 1, 1, 1, 1, 0, 0}, {0, 0, 0, 1, 1, 0, 0, 0}, {0, 0, 0, 0, 0, 0, 0, 0}};
CRGB leds[numLED];
void setup() {
pinMode(data, OUTPUT);
//setup leds
FastLED.addLeds<NEOPIXEL, data>(leds, numLED);
//cycle through array
for(int x = 0; x < 9; x++){
for(int y = 0; y < 9; y++){
if(ledPattern[x][y] == 1){
leds[x*y] = CRGB(5, 0, 0); //if there's a 1, set LED to red
}
}
}
//turn on LED's
FastLED.show();
}
Any help would be appriceiated, Thanks!
PS: Board is Arduino UNO