Application Notes

// 100 Tk = To × 2 (from the datasheet section 8.7.2--To has the units 0.02K)
// Tf = Tk × 9/5 - 459.67 (conversion from Kelvin to Farenheit)
// 100 × Tf = 100 × Tk × 9/5 - 45967
// 100 × Tf = To × 2 × 9/5 - 45967
// 100 × Tf = To × 18/5 - 45967
return (256*high_byte+low_byte) * 18/5 - 45967; // return temperature in units of 0.01°F
}
int main()
{
long object_temperature_f;
clear();
print("press");
lcd_goto_xy(0, 1);
print("button");
wait_for_button(ALL_BUTTONS);
clear();
while (1) // loop forever
{
object_temperature_f = i2c_read_temperature_f();
lcd_goto_xy(0, 0);
// print the temperature in degrees Fahrenheit on the LCD (this code formats it nicely)
if (object_temperature_f < 0)
{
print("-");
object_temperature_f = -object_temperature_f;
}
long integer_temperature = object_temperature_f / 100;
print_long(integer_temperature);
print(".");
long decimal = object_temperature_f - integer_temperature * 100;
if (decimal < 10)
print("0");
print_long(decimal);
print_character(223); // degree symbol
print("F ");
delay_ms(75);
}
return 0;
}
Application Note: MLX90614ESF SMBus Communication with Orangutan Robot
Controllers
© 2001–2010 Pololu
Corporation
3. Software Page 5 of 5