See the datasheet about MCUSR for determining cause of reset.
And this.
https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection/
See the datasheet about MCUSR for determining cause of reset.
And this.
https://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection/