Arduino's memor

Dear community,

I am working in a not too big project with arduino, and I am having problems with the storage memory since the beginning.

The project is basically based on different sensors (which means different libraries, methods, variables..) which collect data.

I started working with the Arduino Micro, but the storage memory was not capable to compile all the code.

Later on, I changed to the new Arduino 101 and then , I could compile the whole code, but some methods and libraries did not work properly, maybe because the Arduino 101 works different from the micro.

Nowadays I am testing the code with the Arduino Uno, and despite of using less than 100% of storage memory (around the 90%) it gives me stability problems if I put all the sensors in the program, and send a very strange commands randomly.

Any suggestion about how can have the whole program using the Arduino code that I have used for the Micro and Uno boards?

I tryied to compact all the code, but since each sensor has his own "part", it is not too easy.

Thanks in advance for your time.

Are you using the String class, by any chance?

aarg: Are you using the String class, by any chance?

Yes, I am using different strings to create a Json (which is also a String).

There is a difference between Strings (capital S) which can cause memory corruption in the small memory of an Arduino and strings (small s) which are just char arrays terminated with a 0 and which do not cause problems.

...R

Robin2: There is a difference between Strings (capital S) which can cause memory corruption in the small memory of an Arduino and strings (small s) which are just char arrays terminated with a 0 and which do not cause problems.

...R

I am using String, if I use string the program can not compile and some libraries must require a String value

If it is strictly a memory problem, and you have used all the memory saving techniques, then you should consider the Arduino Mega2560 board. As you discovered, the 101 is quite different, but most sketches that run on a smaller board should compile on a Mega.

On the other hand, squeezing your code may be the most effective way to accomplish your goal. Have another look at the String situation. When I eliminated String from my Atomic Clock, it shrank by a couple kilobytes of Flash, and nearly 1k of RAM. You can also do things like use the F macro to compile string constants into flash instead of RAM, and use print instead of println. Search the 'Learn' section, there is an article about it there.

post your code and see if people can provide some pointers.

do you any serial.print() in there?

can some of the var/data type be changed?

are you using the F() marco?

I had this same issues a while back and some of the suggestions proved to work great.