Retrieve the temperature of the internal ATMega328 processor using nothing more than the internal registers.
NO external parts or connectins are necessary. All that is needed is the Atmel microcontroller itself. That's it.
Example use:
#include <CPUTemp.h>
// We don't need a setup and a loop function so we just use a single main:
int main() {
Serial.begin(115200);
// Read the processor temperature:
double temp = temperature();
// Format it as a string to 2 decimal places:
char fstr[8];
dtostrf(temp, 6, 2, fstr);
// Display it:
Serial.print("temperature: ");
Serial.println(fstr);
return 0;
}
output:
temperature: 96.70