The code below, somewhere, shows how to measure the temperature of the ATmega328 microcontroller built in to numerous Arduino boards. You can find all the gory details in my new book Arduino Software Internals available from Apress, Amazon and good bookshops everywhere.
A complete guide to how the Arduino Language works, and how it makes the hardware work.
Apress.com: https://www.apress.com/gb/book/9781484257890
Amazon.co.uk: https://www.amazon.co.uk/Arduino-Software-Internals-Complete-Language/dp/1484257898/
The Warning Do not use this code if your Arduino has the AREF pin connected to any voltage source.