@clinker8: Add a line to your
setup()
function something like this (which will wait for a maximum of 3 seconds for the serial monitor to be connected, then proceed):
while (!Serial && millis() < 3000) {}
.
Then, add the following code in the
setup()
function, right after the
while (!Serial && millis() < 3000) {}
line, which will print out any crash information:
Code:
if (CrashReport) {
Serial.print(CrashReport);
}
Note that, if a crash occurs, the crash information will be printed in the SerialMonitor. Instead of printing the crash info to the Serial Monitor, you may need to store that info somewhere that you can retrieve it from after the fact: EEPROM, SDcard, etc.
The report will include an address where the crash was recorded. Paul has also created a CrashReport()
<webpage> with useful details. You can also check the entry in the unofficial Teensy wiki
<here> for links to descriptions of where to find the addr2line utility for both the old (1.8.x) & new (2.3.x) Arduino IDE, as well as detailed descriptions of how to use it.
Good luck . . .
Mark J Culross
KD5RXT