I'm using Streaming.h which adds the very handy << operator to the Serial class.
Serial << "foo" << _DEC(a) << "bar" << _FLOAT(b) << endl;
vs.
Serial.print("foo");
Serial.print(a, DEC);
Serial.print("bar");
Serial.print(b, FLOAT);
Serial.println();
Well I guess I got carried away. If I used "too many" of the << chained together the code would compile but the Arduino would reset. Simply splitting the long chain into two or more separate lines seems to solve the problem.
This might fail:
Serial << "a" << "b" ....... << "y" << "z";
whereas this might pass:
Serial << "a" << "b" ..... "m";
Serial << "n" .... << "y" << "z";
Sorry for the vagueness. It seems to be dependent both on the size of the variables as well as the number of chained << operators.
Which begs the question - why is it failing?
Well, my guess is that the 'duino is running out of stack memory.
My question is what limits stack size and how does one know that limit and program defensively?
Or is this not a stack issue at all?
Any insight gratefully received!
Thanks.