Convert to uint32_t

Hi, I need help to convert temperature from dallastemperature library to uint32_t. I need to display the temperature in the LCD menu via uint32_t variables in m2tklib/

thank you.

uint32_t T = sensor.getTempC();

that should do it.

While yes this works but the temperature is displayed as an integer and I need to show two decimal places. In m2tklib LCD menu like temperature appears only once I need to appear continuously. Thank you for your help

if you want to display it as a float you must convert the float to an integer part and a remainder part (assuming the display cannot print floats)

something like this?

float temp = sensor.getTempC(); uint8_T intpart = temp; uint8_t rempart = (temp - intpart) * 10; // or * 100 for 2 decimals

print intpart print . print rempart

The suggestion from robtillaart will also work with M2tklib, although the commands will be different. Another solution is to multiply the float with 100.0 (for two digits after the comma), convert it to long and then use the ".2" option to place a "." into the uint32_t number. See also the documentation for M2_U32NUM (http://code.google.com/p/m2tklib/wiki/elref#U32NUM)

Oliver