Is there some library or code available that allows me to get the cause of the last reset of an ATMega 328p? My project is supposed to act differently when it was reset by the watchdog timer. I know that the ESP8266 has got a function like that.
There is a register that will tell you. I don't remember which one. See the datasheet.