So I have written a function for my ESP32 using the Arduino IDE, and I needed to write a function to take a combined string of hex values like this:
ffffff0000ffff0000
And split it into an array, like this:
{"ffffff","0000ff","ff0000"}
So far, I've written this:
String colorIndex[] = {};
void processColors(String input){
int count = 0;
for(int i = 0; i < input.length(); i += 6){
colorIndex[count] = input.substring(i,i+6);
count++;
};
for(int i = 0; i < sizeof(colorIndex); i++){
Serial.println(colorIndex[i]);
}
}
But, I've run into a problem where whenever this function is run, the Serial port prints out this error:
Guru Meditation Error: Core 1 panic'ed (StoreProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x4000c3f5 PS : 0x00060830 A0 : 0x800d9575 A1 : 0x3ffd2eb0
A2 : 0x00000050 A3 : 0x3ffd2f10 A4 : 0x00000007 A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x00000050
A10 : 0x00000066 A11 : 0x3ffd3696 A12 : 0x00000007 A13 : 0xed62d3d8
A14 : 0x06000000 A15 : 0x06000000 SAR : 0x00000010 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000050 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffe
Backtrace: 0x4000c3f5:0x3ffd2eb0 0x400d9572:0x3ffd2ed0 0x400d967a:0x3ffd2ef0 0x400d1283:0x3ffd2f10 0x400d1322:0x3ffd2f40 0x400d7345:0x3ffd2f80 0x400d51e9:0x3ffd2fc0 0x400d5279:0x3ffd3000 0x400d8369:0x3ffd3020 0x400d83e9:0x3ffd3060 0x400d89fa:0x3ffd3080 0x40088b7d:0x3ffd30b0
Rebooting...
I googled it, and found that this error is caused by an illegal access to memory. What is causing this and what can I do to fix it? Or, is there a better way to do the task that I wish to do?