Number of decimals in sketches
-
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 "."
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login