Hello together,
I sucessfully transfered my measured values (temperature and humiduty) by DHT11 to ThingSpeak. In Payload I calculated the dew point (“TD = Math.pow (T/10000,(1/8.02))*(109.8+H/100)-109.8”) but I got numerous decimal places. Now I would like to truncate it. The functions I found in the forum like decimal.Round will not lead to the target. Do you have a suggestion?
Many thanks in advance, Thomas
Do you mean in the JavaScript decoder or do you mean a calculation on ThingSpeak?
Yes, I mean the decoder in ttn>applications>“app-ID”>payload to calculate the dew point (I know that it’s possible to do it already in the Ardino-sketch).
Add this .toFixed(2)
I think
TD = (Math.pow (T/10000,(1/8.02))*(109.8+H/100)-109.8).toFixed(2))
Will truncate to 2 decimal places. 0 for non decimal.
Or you want Math.round(Math.pow (T/10000,(1/8.02))*(109.8+H/100)-109.8)
without decimal places?
@ clv - Thanks a lot - Both functions are working well - My mistake was to set the proper notations!