Go Down

Topic: Code behaves different with only one conditionl (Read 414 times) previous topic - next topic



I have a code where I have this array:

long test[2][100];

I store many data inside this array. The problem is that now I made a small change in my code and everything stopped working. Adding the following line at the bottom end of my loop() function makes arduino "crazy", it does not work, does not print the serial data...

if (true) {



Why just adding this code to my previous code makes it not work anymore?


It depends of your code. Can you post your code?


Your array is large in arduino terms. Depending on which one you are using you may be out of memory and your serial print was what pushed it over the top.



Dec 04, 2014, 08:40 am Last Edit: Dec 04, 2014, 08:41 am by Shpaget
Your array is being stored in SRAM, not flash.
Uno, which uses Atmega328, has 2KB of SRAM. Long takes up 4 bytes.


My code is huge full of portuguese variables.
Regardless, post your code. The C++ part we will understand.
Please post technical questions on the forum, not by personal message. Thanks!

More info: http://www.gammon.com.au/electronics

Go Up