Here is how to reproduce the problem:
- I tried the example in the millis() reference page millis() - Arduino Reference.
- Loaded it in Arduino (used Mega 2560). Everything works fine: millis() is printed each second incrementing properly.
- Disconnected the "Serial Monitor" (on Mac OS X 10.11.5) by closing the window.
- Re-connected "Serial Monitor" (opened it a gain). When the Arduino connected, Time using millis() started counting from 0, which is an indication that the Arduino got re-set.
Should this be happening?
Is there an undocumented exception that is being thrown that could be captured in a try-catch block?
Please help.