I have a routine I have to get the internal temperature on the 32u4. The only part I wasn't 100% sure of was the returned value, but the research I did in the Atmel documentation led me to believe it's the absolute temperature in kelvin. Here's the routine:
int getTemperature() {
// routine provided by TCWORLD in Sparkfun forums - thank you very much TCWORLD!
// see here for details: http://forum.sparkfun.com/viewtopic.php?f=32&t=32433
ADMUX = 0b11000111; // set the adc to compare the internal temp sensor against
ADCSRB |= (1 << MUX5); // the 2.56v internal reference (datasheet section 24.6)
delay(5); // wait a moment for the adc to settle
sbi(ADCSRA, ADSC); // initiate the first conversion - this one is junk as per datasheet
while (bit_is_set(ADCSRA, ADSC)); // wait for the conversion to finish
delay(5); // another little extra pause just in case
sbi(ADCSRA, ADSC); // initiate the second conversion - this is the good one
while (bit_is_set(ADCSRA, ADSC)); // wait for the conversion to finish
byte low = ADCL; // read the low byte
byte high = ADCH; // read the high byte
int temperature = (high << 8) | low; // result is the absolute temperature in Kelvin * i think *
temperature = temperature - 273; // subtract 273 to get the degrees C
temperature = temperature * 18; // times by 90 & divide by 5 (.1 precision without floats)
temperature = temperature + 320; // then add 320 to get degrees F x 10
temperature = temperature / 10; // then divide by 10 to get degrees F
return temperature;
}
Cheers!