I have ESP-12E board which is being used with nodemcu firmware 1.5.4, I tried connecting to my router but it is not able to connect properly. I am using following code:
print("Connecting to WiFi access point...")
wifi.setmode(wifi.STATION)
wifi.sta.config(wifi_ssid, wifi_password)
-- wifi.sta.connect() not necessary because config() uses auto-connect=true by default
tmr.create():alarm(1000, tmr.ALARM_AUTO, function(cb_timer)
if wifi.sta.getip() == nil then
print("Waiting for IP address...")
else
cb_timer:unregister()
print("WiFi connection established, IP address: " .. wifi.sta.getip())
print("You have 3 seconds to abort")
print("Waiting...")
tmr.create():alarm(3000, tmr.ALARM_SINGLE, startup)
end
end)
I tried connecting to multiple routers but all of them are having issues.
I tried using Arduino IDE using NodeMCU 1.0 (ESP-12E Module) with following code and it connected fine:
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
I am trying to test out this project which is written in lua: https://github.com/heythisisnate/nodemcu-smartthings
Tried porting it to Arduino but its limited feature in finding out the exact GPIO pin that caused the interrupt is a limitation.
Can you guys help how to get WiFi working fine with lua.
Thanks,
Sambi