Skip to content

Instantly share code, notes, and snippets.

@changs
Last active July 6, 2017 17:28
Show Gist options
  • Save changs/2c60e2e1ba41c1d2ac4257ed714f9e1c to your computer and use it in GitHub Desktop.
Save changs/2c60e2e1ba41c1d2ac4257ed714f9e1c to your computer and use it in GitHub Desktop.
wifi.setmode(wifi.STATION)
wifi.sta.config("nazwawifi","haslo")
wifi.sta.connect()
tmr.delay(1000000)
print(wifi.sta.status())
print(wifi.sta.getip())
tmr.alarm(0, 400000, 1, function ()
require 'ds18b20'
ds18b20.setup(4)
temp = ds18b20.read()
print("T: "..temp.."'C")
http.post('http://adres_mojego_influx_db:8086/write?db=home',
'Content-Type: application/x-www-form-urlencoded\n',
"temperature,host=nodemcu,room=living_room value="..temp,
function(code, data) print (code) end
)
end)
ds18b20 = nil
package.loaded["ds18b20"]=nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment