Go Down

Topic: interrupts with conditions (Read 2949 times) previous topic - next topic

Nick Gammon

Quote

Code: [Select]

String msg = String("");



Please note that in versions of the IDE up to and including 1.0.3, the String library has bugs as discussed here and here.

In particular, the dynamic memory allocation used by the String class may fail and cause random crashes.

I recommend reworking your code to manage without String. Use C-style strings instead (strcpy, strcat, strcmp, etc.), as described here for example.

Alternatively, install the fix described here:  Fixing String Crashes

Preferably upgrade your IDE to version 1.0.4 or above at: http://arduino.cc/en/Main/Software
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

nightcrawler218

Thanks Mr. nick for letting me aware of the issue.
"Imagination is more important than knowledge."
-Einstein

GoForSmoke

I note that even with the fixed free, C++ Strings still copy themselves to change length.

C++ Strings are wasteful of both RAM and cycles. They were made for PC's and people who would rather save on typing and learning than to think.

Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts

Go Up