Advertisement
Sandbird

Untitled

Jun 4th, 2016
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.28 KB | None | 0 0
  1. -- File: ds.lua --
  2. -- Paste bellow code to file --
  3.  
  4. t = require("ds18b20")
  5. -- GPIO0 is pin 3
  6. pin = 3
  7. lasttemp = 0
  8. t.setup(pin)
  9. temperature=t.read()
  10. lasttemp = temperature * 1.8 + 320000
  11. t1 = lasttemp / 10000
  12. tempout=(string.format("%2d", t1)
  13. print("Temperature: "..tempout.."'F")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement