Hi everyone,
I've been having this issue (not for the first time, but now it's unbearable) where my arduino nano will crash, auto reset, print partial messages or just garbage to the Serial Monitor.
- Baud rate in Serial Monitor matches the Serial.begin(9600)
- it randomly prints good and bad, with no changes in the code (just modifying, undoing and re flashing)
- commenting or ADDING Serial prints / writes may FIX the issue.
- tried the printing with F()
- the program may work very properly, not work at all, or work partially (for example, it may loop, print stuff, but not make proper digital / analog writes).
So this not only affects the Serial Monitor, but the execution of the program.
That being said, I suspect it may be a memory overflow (as I'm working with several objects, pointers and arrays), but it's being very difficult to find where that is happening (i try doing freeMemory() but as the Serial Monitor works whenever it wants, it's kind of unusable).
I attach 2 images: same code, but if I print less, it crashes (chinese weird output). If I print MORE, it works...
It's like I need to add Serial Prints in order to "unclog" it and continue the execution, otherwise it dies.
Sometimes it executes twice or three times the Setup, and only then goes to the loop.
Any idea what can be happening?
Thanks!