Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --emon.lua
- require('ds18b20')
- -- ESP-01 GPIO Mapping
- gpio0 =3
- gpio2 =4
- ds18b20.setup(gpio2)
- print("Start logging to EmonCMS with 30 sec interval \n")
- tmr.alarm(0,30000, 1, function()
- t=ds18b20.read()
- print("Temp:" .. t .. " C\n")
- conn=net.createConnection(net.TCP, 0)
- conn:on("receive", function(conn, payload) print(payload) end )
- conn:connect(80,"192.168.11.11")
- conn:send("GET /emoncms/input/post.json?apikey=a796c652d70a5f682f77e783f8ec11ad&node=2&json={tBinnen:".. t .."} HTTP/1.1\r\nHost: www.local.lan\r\n" -- This line defines the json style post
- .."Connection: keep-alive\r\nAccept: */*\r\n\r\n")
- end)
Advertisement
Add Comment
Please, Sign In to add comment