Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- File: ds.lua --
- -- Paste bellow code to file --
- local function toFahrenheit(c)
- return c * 9 / 5 + 32
- end
- t = require("ds18b20")
- -- GPIO0 is pin 3
- pin = 3
- lasttemp = 0
- t.setup(pin)
- temperature=t.read()
- lasttemp = temperature
- t1 = lasttemp / 10000
- tempout=(string.format("%2d", toFahrenheit(t1))
- print("Temperature: "..tempout.."'F")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement