Im trying to detect when the module actually connects to my wifi AP, since .connect does not have a callback im doing something simple like this:
wifi.sta.config("SSID","password")
wifi.sta.connect()
tmr.delay(1000000)
i = 0
while(wifi.sta.status() ~= 5 and i < 10) do
print("Waiting")
print(wifi.sta.status())
i = i + 1
tmr.delay(1000000)
end
But the output of .sta.status() is always 1 inside the loop. When it finish, if I send the command =wifi.sta.status() manually from the IDE it tells me 5. Why?