I'm currently working on I2C sensors, where one of them is enough to throw a mistake, the library is probably poorly designed and the Arduino freezes. In this regard, I am now looking for the possibility that the freezing of the Arduino can be saved by software, ie restart it. Does anyone have a solution with this code? SHT31 freezes. The BME280 pressure sensor also freezes. It basically freezes the whole Arduino.
There is a restart for this if such an error occurs. Of course, I don't want the Arduino to restart all the time if there's a sensor error. Need to monitor the error rate, count it and restart only when needed.
I run my smarthome network with more than 30 SHT31 sensors connected to ATmega328p devices. I never had a freeze (yet). This means, if you designed your hard- and software correctly it can run for years without a problem. As you failed to provide any information about your hardware and software it's up to you to find the error that let it freeze.
If you decide to live with the occasional freezing a very ugly work-around for your problem is to activate the watchdog. If your code doesn't update within a certain time frame the hardware will reset your Arduino.
Your code is posted in this forum (don't forget the code tags) or simply ignored. We don't follow links to temporary web storage as any user following that link in a year or two will fail.