I have a NodeMCU flashed with the latest firmeare version (NodeMCU 0.9.6 build 20150704 powered by Lua 5.1.4).
I can connect to my wifi router, but I cannot get access to any Internet url.
I get DNS retries and finally "DNS Fail!"
This is my code:
wifi.setmode(wifi.STATION)
wifi.sta.config("accesspointname","yourpassword")
wifi.sta.connect()
if 5 == wifi.sta.status() then
print("Connected to ", ssid)
print(wifi.sta.getip())
else
print("Not connected to ", ssid)
end
-- I get a proper IP addres after this.
-- Now connect to a URL
sk=net.createConnection(net.TCP, 0)
sk:on("receive", function(sck, c) print(c) end )
sk:connect(80,"www.adafruit.com")
sk:send("GET /testwifi/index.html HTTP/1.1\r\nHost: www.adafruit.com\r\nConnection: keep-alive\r\nAccept: */*\r\n\r\n")
The example is from here, but there are many similar examples.
Please advise.
Thanks!