Hello.
I am trying to create a dynamic 2D array.
I have seven zones which i am trying to fill with a selected pattern, whose size is dynamically generated depending on how "large" the each of the zones. The pattern depends on the size of the zone.
I know the first dimension of the array, but not the second.
byte hueArray[7][??];
byte *hueArray = (byte *)malloc(patternLength * sizeof(byte));
I've been using this to generator a dynamically sized single array.... but now that i am adding zones, i need to do this for each zone.
even something like
byte *hueArray1 = (byte *)malloc(patternLength * sizeof(byte));
byte *hueArray2 = (byte *)malloc(patternLength * sizeof(byte));
byte *hueArray3 = (byte *)malloc(patternLength * sizeof(byte));
would work, assuming later on in the program i could some how select which array to read and write without needing a whole lot of switch/case statements.
eg,
for(int i = PatternStart; i < PatternEnd; i++){
hueArray[ZONE][i] = value;
}
I have also posted my code. The problems are in the "LEDprgrams" tab and subsequent pattern functions, "ZA"-"ZK". Be warned, its a lot of code.
Archive.zip (17.5 KB)