Go Down

Topic: Serial Freezing (Read 2 times) previous topic - next topic

PaulS

Code: [Select]
double surroundingsMap[300] = {0};
1200 bytes of memory used, right there. Is this on a 328-based Arduino, with 2048 bytes of memory?

Changing the resolution of the values stored, so that one unit is say 1/10" of an inch or 1/4 of a centimeter would cut your storage requirements in half.

steeljack

Quote
Changing the resolution of the values stored, so that one unit is say 1/10" of an inch or 1/4 of a centimeter would cut your storage requirements in half.


While you're correct, and I probably should change the resolution of my scan, I'm not sure what you mean by "1/10" " since this is a rotational scale, not a linear one. The 300 is the number of ticks in a complete turn on my encoder.

PaulS

Quote
I'm not sure what you mean by "1/10" " since this is a rotational scale, not a linear one.

The index is a rotational value. The data stored in the array is distance data. If you used ints, and stored 10ths of inches (78, instead of 7.8, for example), you'd use only half as much memory.

steeljack

Oh, I see what you're getting at now. I found my problem with Serial freezing, too. I noticed I had a print in an interrupt, which doesn't work.

Go Up