Pages: [1]   Go Down
Author Topic: string argument to a function - memory problem with RAM  (Read 139 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Jr. Member
Karma: 0
Posts: 68
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


in my current project I have follwing problem.

I want to transmit a string argument to a function from my main loop.
The project contains at the moment about 2500 codeline and i have only 358 bytes free memory ( freeMemory () )

When I did the coding like the code here,the arduino will restart ( again and again ) after loading the new sketch. I think I must have a memory problem maybe with useing the mySoftSerial.print ( in my case Scada.print) function, because I think it is good to use a pointer to my char array ( string )
Or what are you thinking where the bug is located ??

The SendToScada("...") function is called some times in my code

void loop()
    //do some other work here
    sendToScada("this text should be send to a scada system");

void sendToScada(char* sMessageToSend)
   Scada.print("V"); // Messageheader
   for(int i=0;i<strlen(sMessageToSend);i++)
   XBee.listen(); //set to other serial active

East Anglia (UK)
Offline Offline
Faraday Member
Karma: 118
Posts: 4339
May all of your blinks be without delay()
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have a look at this page
As you will see it is possible to store strings in flash memory to save program space.

Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Pages: [1]   Go Up
Jump to: