Hey guys, I'm making stuff. Here's my struct code:
typedef struct {
unsigned int raw[100];
int time;
} myThing;
myThing myThings[100];
I'm trying to instantiate members through the following:
for (int i = 1; i < len; i++) { // len is arbitrary, but always < 100
if (i % 2) {
myThings[index].raw[i - 1] = results.rawbuf[i]; // where results.rawbuf[n] returns an unsigned int
}
else {
myThings[index].raw[i - 1] = results.rawbuf[i];
}
}
It compiles no worries, but seems to freeze up my boards, both Arduino Uno and Mega. When changed from a struct to global variables it also works no problems, but that approach isn't practical for what I want. In C++, I'd probably do this as a 2D vector of unigned int array and int, but I'm not sure how to do that in Arduino land.
I've tried RTFM, but can't find things either things this specific, or things that I can absorb information from.
My question is, is there anything blatantly wrong that I'm doing, and if so what? Or, is there an alternate route I can take (for example a 2D array of arrays and ints)?
Thanks.