simples! if i set a CRGB array to 54, and i access 100 on purpose, do i put the code in jeopardy, or does it just ignore it?
i have led arrays where some of the number of pixels i want lit range, from 1 to 6, but to access these in nice and easy to use code, i want to use a multidimensional array array[6][6], but to only light 1 leds in an array of 6, ive made a pixel/variable set to 100 and named it BLANK.
ive put the code in, so lines read along the lines of;
array[4][6] = {3, 5, BLANK, BLANK, 4, 1}
and it seems to be working fine, but ive got this halting feeling that later in the code it may rear its ugly head!
First, in any C/C++ program, accessing off the end of an array is a big giant No-No; don’t ever do that.
But that said, I like the idea you have for BLANK. If you look at the code and comments in the XYMatrix example, you’ll see some notes on how to set up a “safe” extra pixel which you can refer to like this. Give it a shot and see what can do; we’re happy to help get it refined once you’ve got the basics sketched out.
i will look at the xy example, but I’m now thinking that if i was to simply make my string of leds (54) long, and just CRGB(55) long, then set the blank to 55… the code will try to light an led which doesn’t exist, which on previous plays, doesn’t seem to do any damage…
@Kelvin_Mead yep! That’s the idea!
My only alternative idea is to have the underlying storage array be 55 long, but the symbol “leds” point to the [1] element of the storage, not the [0] element - and then use “-1” as the magic value.
Yours is simpler 