This compiler output:
versus the 4x32x32=4096 bytes required by:
![]()
...is a problem.
Also this doesn't look like good syntax (won't compile):
Code or Out.
This compiler output:
versus the 4x32x32=4096 bytes required by:
![]()
...is a problem.
Also this doesn't look like good syntax (won't compile):
Code or Out.
What should be the way forward? What should I change now to keep this project running? I am not an expert in this field, but I have to do it as their is no other option.
Do you need to read all sensors, store the results then print the results?
Or can you measure, store and print in 4 groups of 16 x 16?
I have to read all the sensors in real-time as project demands it.
I use the same code for 1616, and it works pretty fine. I can read the all sensors in real time. But when I move to 3232, arduino freezes. Doesnt print anything.
Then if your sensor array is 32x32, you have an unsolvable conundrum. Project demands vs Reality Bites, I'd say.
16x16 uses 1/4 the space of 32x32, so of course it fits and leaves enough memory for other processes. 32x32...not so much.
Change processors. I'd suggest an ESP32, but I haven't looked at the rest of your project details.
What size is your raw data from the sensor digitizer?
Again, my answer is that I have worked with 32*32 resistive-based pressure sensors (doesn't use any chip that works on i2C). It worked perfectly. But when I am doing some for capacitive sensors (chip with i2c), it freezes arduino.
I have to figure this out. I don't know yet.
Show us compilable code for a double array 32x32, on an Uno.
@kapple1736 Hello Camsysca,
I cannot post the full code on the Arduino forum as the project i am working on is confidential.
Gotcha. No, I don't suppose you can. After all, confidential code is the only code that will compile a float array of dimensions 32x32, let alone double, on an Arduino Uno, after all. Must use a special, proprietary compiler for that one.
!Muted!
The code below compiles for 16x16 and 32x32, but for 32x32, it just doesn't work.
const int SIZE = 16; // 32 doesn't work
void setup() {
float prod[SIZE][SIZE];
Serial.begin(115200);
for ( int ii = 0; ii < SIZE; ++ii) {
for ( int jj = 0; jj < SIZE; ++jj) {
prod[ii][jj] = (ii + 1) * (jj + 1);
}
}
for ( int ii = 0; ii < SIZE; ++ii) {
for ( int jj = 0; jj < SIZE; ++jj) {
if (prod[ii][jj] < 10) Serial.print(" ");
if (prod[ii][jj] < 100) Serial.print(" ");
Serial.print(prod[ii][jj], 0);
Serial.print(" ");
}
Serial.println();
}
}
void loop() {
}
(21x21 is interesting in Wokwi)
I am sorry. See, I am not an expert in programming. I am trying to learn new things. I can share the code with you personally, and I need your advice.
I didn't get your point. Please can you elaborate on this?
I did:
If, after putting your program onto the Uno, there is only 1590 bytes for local variables, what is a program supposed to do when it reaches a statement that asks for 4096 bytes worth of storage?
You could solve it by designing the rest of your code to work with smaller chunks of data. I.e.:
Thank you for the suggestion. Is programming environment similar for esp32.
I have to basically work for 64*64 array at the end. Will esp32 be sufficient.
Doubles will be twice as big as on the Uno, but yes--an ESP32 has 500k of memory vs the 2k on an Uno.
My thought is: if the data comes in as a unsigned int, but gets converted to a double due to the scaling factor(s). Perhaps the scaling factors can be added at the print statement, therefore keeping the size of the 32 x 32 smaller.
Apologies, agreed. Our problem here is that our OP is not cognizant of memory limitations beyond the compiler summary of available memory. The idea that more memory may be dynamically allocated later isn't yet on his horizon. To illustrate that, just move your array declaration out of setup(), and the compiler result is as I suggested. 32x32 fails, 16x16 is okay.