Chat freely about anything...
User avatar
By nedoskiv
#71646 Hello
I'm new to esp8266 so my goal is simple, to make a loop that connects to a web server wait for data from it (or error) and do something depending of what command it receives or if an error accurs.

My limited knowledge led me to http library, but looks like it is a asynhronous function and my lua script do not work preperly, so I use a variable and make rest of the script until http function call it fallback funtion. But looks like board restart by some reason, I tried of different version of nodemcu, even with net library instead of http one, and board still restarts
here is my simple script:

Code: Select allTstart  =
print('httpget.lua started at ' .. Tstart)
code = nil
success= 0

http.get("", nil, function(code, data)
    if (code < 0) then
      print("HTTP request failed")
      print(code, data)

print ("waiting for function to complete\n")
while success==0
   print (

print ("here is the data\n")
print (code)

I never see "here is the data" message, probabbly restart after while condition ends.

Thank you in advance for your attention.