- Sat Jun 06, 2015 6:02 am
#19638
I have added the following line to ds18b20.lua in order to round the value.
t = string.format("%02.1f",t)This line is added almost at the end of ds18b20.lua, before the line "return t". To change the number of decimal places adjust the value before f. I.e. .1f .2f etc.
I am not sure if this is the most efficient or correct way to do this but it works for me. After editing ds18b20.lua you will need to upload and compile it again.
I have posted my ds18b20.lua to this url for reference
https://docs.google.com/file/d/0B6gn-WoB7xpCdG95SjFPUE9xVVE/edit?usp=docslist_apiBe aware that I have stripped my ds18b20 down and it can only display Celsius, if anyone else has any suggestions on how to round this value input would be appreciated.