Re: post to thingspeak.com
Posted: Tue Sep 15, 2015 1:17 pm
Could you write me a code for DS18B20?
init.lua & ds18b20.lua
I will be very grateful.
init.lua & ds18b20.lua
I will be very grateful.
-->
Open Community Forum for ESP8266, Come share Arduino and IoT (Internet of Things)
https://www.esp8266.com/
apiKey = "xXx" -- Add thingspeak api key
conn=net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload) print(payload) end)
-- api.thingspeak.com 184.106.153.149
conn:connect(80,"184.106.153.149")
conn:send("GET /update?key="..apiKey.."&field1="..tempin.."&field2="..hum.."&field3="..tempout.."")
conn:send("Host: api.thingspeak.com\r\n")
conn:send("Accept: */*\r\n")
conn:send("User-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n")
conn:send("\r\n")
conn:on("sent",function(conn)
print("Closing connection")
conn:close()
end)
conn:on("disconnection", function(conn)
print("Got disconnection...")
end)