You are createing a do{}while
loop inside the loop()
, that has no meaning as they do the same things, infact if you look at the .cpp created in the temp folder (activate "verbose compiling" from the menu), you will find something similar to;
int main(){
setup();
while(1){
loop();
}
}
BUT
String dataString="";
is called only one time, then dataString
is modified only ADDING char, so it will grow until it will overflow and do bad things to your ram.
Infact, if you look at the SD file, you should find
read1,
read1, read1, read2,
read1, read1, read2, read1, read1, read2, read3,
and so on
There are 2 solution:
remove the
do{}while
loop as it is rendoundant, that waydataString
will be destroied at the end of the loop, and recreated (empty) at the beginning;dataString = "";
before the between thedo{
andfor
, that will not destroy and recreate the variable, but just clear its value.