I think we've got a little bug hiding in the Arduino core files somewhere for the Mega1284p. Here's a very simple code snippet that inexplicably crashes within 10 seconds on Goldilocks (as well as my own Mega1284p based board), but which does not crash on an Arduino UNO (or other Mega328p-based board).
Code: Select all
void setup()
{
// just to be able to monitor what is happening
Serial.begin(9600);
}
//String dataString; // defining it here seems to solve the problem
int val = 0;
void loop()
{
String dataString = "";
dataString += String(val*70);
dataString += ",";
dataString += String(255);
dataString += ",";
dataString += String(255);
Serial.println(dataString);
delay(250);
val++;
}
Also, notice that the crash does not happen on Goldilocks (or my board) if the dataString variable is declared globally (outside of the loop function). What do you all think? It is kind of boggling my mind.