ESP8266 の NodeMCU プログラミングは初めてです。文字列をサーバーに送信し、応答文字列を受信する必要があります。というわけでコードを書いてみましたが、うまく動きません。私のプログラムは時間をかけて動作し、メモリがいっぱいであるというメッセージを表示します。手伝って頂けますか?
---------init funсtion-----------------
wifi.setmode(wifi.STATION)
wifi.sta.config("TP-LINK_ROBOT","63793246")
wifi.sta.connect()
---------------------------------------------
function hello (sck,c)
print (c)
sk:close()
if c == "Thank you" then
print("Great!")
end
end
function test()
sk=net.createConnection(net.TCP, 0)
sk:on("receive", hello)
sk:on("sent", function(sck) end)
sk:connect(9999,"192.168.0.100")
sk:send("HELLO")
print("sent to server")
end
test()