Hi there. I googled for a problem concering my little arduino projects.
It would be to complicated to upload my whole program so I take a codepart which I've found in this forum(http://arduino.cc/forum/index.php/topic,95914.30.html) and is pretty much alike my problem:
#include <MemoryFree.h>
void setup() {
Serial.begin(9600);
}
void loop() {
int n = 0;
while(n <=100) {
int u = 20*n;
int v = 30*n;
String str = String(n) + ", " + String(u) + ", " + String(v) + ", " + String(freeMemory());
Serial.println(str);
delay(500);
n++;
}
Serial.println("Done");
}
As far as I understand, its a problem of arduinos memory that's used to store the variables.
I also followed this posts http://arduino.cc/forum/index.php/topic,95914.0.html and I think its dealing with the problem(isnt it?).
To be honest, im not a native english speaker and ive got a difficult time following these solutions.
My question is:
1.Is there a library to download to replace the broken one?
2. If not, is there a workaround(proofed? dont want to destroy my board, saved my pocketmoney for a long time <.<)
3. If nothing helps I have to surrender and stop using String?
Im sorry for creating this new topic but i really didn't get what to do in the mentioned topics above.
Wow. its awesome to see how fast you answer.
If I use the patch, do I have to implement it then on every single file in which I use String or do I use the "working String" automatically?
If I use the patch, do I have to implement it then on every single file in which I use String or do I use the "working String" automatically?
The patch fixes the free() function that is called by the String destructor. No changes to the String class are needed (Well, they are, but it is not up to you to make them) nor are changes needed to any sketches that use the String class.
Ok. When I'm at home I'll try the patch.(is it a community-made one or a official? Don't want to lose my warranty)
Btw, is here any thank-you-function?
well..the string which is shown is the same as in the code above.
but I'm working with serialevent-methods..that wont work..every print will call it another time..i hoped to find a solution to fix the String/free()/what-ever bug.
I haven't found the proper patch yet but if there's one, I'll find it at all cost
TY though!
but I'm working with serialevent-methods..that wont work..every print will call it another time.
I'm thinking that you don't understand how the serialEvent() method gets called, or serial data processing, then.
Using one Serial.print() or a dozen Serial.print() statements makes no difference to how the data is eventually shifted out the serial port, or how it is received on the other end.
I'm using Java. Every time I print()/println() the event is called in java(I'm using the rxtx library of java and the method is called serialEvent(SerialPortEvent oEvent))
But you are right. I'm a newbie trying to get these things to know by watching examples and trying to find out what everything does. There are easier ways to do that, sure..