Number of decimals in sketches
General Discussion
3
Posts
3
Posters
1.4k
Views
1
Watching
-
I don't want the emperature humidity to be as precise as in the sketch which has 2 decimal points.
So for the humidity i rewrote the sketch as such
float hum_floa = dht.getHumidity(); float humidity = round (hum_floa);It works but the data is still sent as yy.xx
Is there a simple way to make it as yy only? -
There are probably better ways but:
hum_floa.remove(temp.indexOf('.') + 2)Dont know the dht lib, maybe you can set some settings there to recieve without decimals.
This will not round but just cut/remove the last digits after "."