I’m having problems understanding how to get elements from multidimensional array, the code runs, and it doesn’t seem like I have any errors, but when I check my Particle.function, I’m expecting to get the return value of 1000. Instead, I get what seems to be random values. The Code:
const int FaceEmoteTime0[31] = {143, 143, 143, 142, 143, 143, 143};
const int FaceSize0 = sizeof(FaceEmoteTime0) / sizeof(FaceEmoteTime0[0]);
const int* FaceEmoteTimeArray [][31] = {FaceEmoteTime0};
const int FaceSizeArray[] = {FaceSize0};
int TotalTime;
int Plays;
int FaceNumber = 0;
void setup() {
Particle.function("TimeZone", TimeZone);
}
void loop() {
if (Plays == 0) {
for (int i = 0; i < (FaceSizeArray[FaceNumber]); i++) {
TotalTime += *FaceEmoteTimeArray[FaceNumber][i];
}
Plays++;
}
}
int TimeZone(String command) { // Set Time Zone.
return TotalTime;
TotalTime = 0;
Plays = 0;
}
Edit: just to be clear I’m trying to make the code
TotalTime += *FaceEmoteTimeArray[FaceNumber][i];
Act as is it were
TotalTime += (FaceEmoteTime0[i]);
which would give the correct value.