I have a dht22 connect to my esp8266 and I read the temperature and the humidity to float variables.
These float have a lot of decimal, if I print them I've got something like :
23.45634953
I want this float on another variable with only two decimal, that's way I can send this variable to my home automation system.
I try to round it with :
round(float*100)/100
But it doesn't work, the variable have all decimal, it's like I didn't do something
I try to convert it to int then convert it back to float, but it doesn't work.
I try to convert it to char[2] then convert it back to float, it doesn't work either.
Is there a way to save the float value to another variable with only two decimal ?
Thank a lot