I have a problem with thingspeak. I am trying to upload 4 fields and it fails...
With 3 fields this code is OK
-- send to https://api.thingspeak.com
function sendTS(APIkey, moisture, temp, humi)
conn = nil
conn = net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload)success = true print("receive"..payload) node.dsleep(30000000) end) --send and deep sleep
conn:on("connection",
function(conn, payload)
print("Connected TS")
print ('moisture ' ..moisture)
print ('temperature ' ..temp)
print ('humidity ' ..humi)
print ('voltage ' ..vdd)
conn:send('GET /update?key='..APIkey..'&field1='..moisture..'&field2='..temp..'&field3='..humi..'HTTP/1.1\r\n\
Host: api.thingspeak.com\r\nAccept: */*\r\nUser-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n\r\n')
end)
conn:on("disconnection", function(conn, payload) print('Disconnected') end)
conn:connect(80,'184.106.153.149')
endBut the same with 4 fields doen't work... Node restarts...
Any idea please ?
-- send to https://api.thingspeak.com
function sendTS(APIkey, moisture, temp, humi, bat)
conn = nil
conn = net.createConnection(net.TCP, 0)
conn:on("receive", function(conn, payload)success = true print("receive"..payload) node.dsleep(30000000) end) --send and deep sleep
conn:on("connection",
function(conn, payload)
print("Connected TS")
print ('moisture ' ..moisture)
print ('temperature ' ..temp)
print ('humidity ' ..humi)
print ('voltage ' ..vdd)
conn:send('GET /update?key='..APIkey..'&field1='..moisture..'&field2='..temp..'&field3='..humi..'&field4='..bat..'HTTP/1.1\r\n\
Host: api.thingspeak.com\r\nAccept: */*\r\nUser-Agent: Mozilla/4.0 (compatible; esp8266 Lua; Windows NT 5.1)\r\n\r\n')
end)
conn:on("disconnection", function(conn, payload) print('Disconnected') end)
conn:connect(80,'184.106.153.149')
endJP