STM32 microcontrollers have got internal temperature sensor, that connected to one of ADC-channels, that makes possible in easy way get your device temperature without any additional components. This rough measurements can be used to estimate gadget status.
Tested on: STM32F401CCU6 (Black Pill)
Temperature range: -40°C to 125 °C
Accuracy: ±1.5 °C