Pages: [1]   Go Down
Author Topic: Out of Memory  (Read 570 times)
0 Members and 1 Guest are viewing this topic.
USA
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think I am out of sram but i'm really not sure can anyone verify?

Code is attached it was to long to post.

* codewfunc2.pde (12.59 KB - downloaded 20 times.)
Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe/probably thats the problem, learn how to use PROGMEM and move all those static strings to flash so they dont occupy any ram.
http://www.arduino.cc/en/Reference/PROGMEM
Logged

Atlanta, GA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this gives you a function that can check your ram
http://jeelabs.org/2011/05/22/atmega-memory-use/
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7188
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Too many strings. Either make them shorter or store them in PROGMEM.
Logged


USA
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I was under the impression that the doubles and floats were taking up the majority of the memory.

I only use the strings to parse the data out of them maybe I could just have one function to read in the variables I need and then set them back to null?
Logged

Portugal
Offline Offline
God Member
*****
Karma: 6
Posts: 962
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Every variable and strings are located in ram, a string is just an array of chars, so all of your serial.prints("bla bla bla") eat 1 byte of ram for each character and that is used for ever.
Logged

USA
Offline Offline
Newbie
*
Karma: 0
Posts: 34
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Wow I had no idea.  That solved my initial problem but I seem to have another.  Everything works correctly except the m command.  When I send that command all the info displays correctly, but it appears that the arduino resets after it completes this command.

* codewfunc3.pde (12.65 KB - downloaded 11 times.)
Logged

Pages: [1]   Go Up
Jump to: