Cant recieve the answer back when query Thingspeak
Posted: Mon Sep 28, 2015 6:06 pm
Hi! I cant get the answer back when asking thingspeaks about the last value of a field of a certain channel: 184.106.153.149/channels/44665/fields/1/last?key=O2R7O7BYS6M7ES10 which goes ok from firefox, here is part of the code
I used this secuence to comunicate 2 esp8266 and I could recieve the server answer, any idas of what I am doing wrong?
Thanks in advence!
Code: Select all
wifi.setmode(wifi.STATION)
wifi.sta.config("telecentro","bamboklat")
wifi.sta.connect()
tmr.alarm(1, 1000, 1, function()
if wifi.sta.getip()== nil then
print("IP no disponible, esperando...")
else
tmr.stop(1)
print("Config hecha, IP: "..wifi.sta.getip())
end
end)
tmr.alarm(2, 4000, 1, function()
if (wifi.sta.getip() ~= nil) then
sk = net.createConnection(net.TCP, 0)
sk:connect(80,'184.106.153.149') -- server ESP IP
sk:on("connection", function(sk)
sk:send('GET /channels/44665/fields/1/last?key=O2R7O7BYS6M7ES10')
end )
sk:on("receive", function(sk, receivedData)
print("received: " .. receivedData)
sk:close()
end)
else
print("no connection...")
end
end)
I used this secuence to comunicate 2 esp8266 and I could recieve the server answer, any idas of what I am doing wrong?
Thanks in advence!