As the title says... Chat on...

User avatar
By Andy1
#36232 I have an odd error I can't resolve: Flashed a ESP8266 12E with latest firmware and put a slighly longer version of the code put in the init.lua (only more rows of tmr.delay and gpio.write high/low) and I get the SSID running.
After that it seems like the gpio high/low works (the LED works as intended) but there is no longer any wifi. No SSID no nothing.. And the unit is extremely hard to connect to, generally the only solution is to flash the firmware again. Then the SSID works fine again. Until I add the code below.

I have no clue what is going on here. Any input appreciated, I am very new to this..

I am only trying to at lowest possible power usage show an SSID, blink a LED and then shut it down after a minute (with a external latching relay or dsleep)

---

wifi.setmode(wifi.SOFTAP)
wifi.PHYMODE_G
wifi.ap.config({ssid="MySSID",pwd="password"})
gpio.mode(1,gpio.OUTPUT)
gpio.write(1,gpio.HIGH)
tmr.delay(100000000)
gpio.write(1,gpio.LOW)
tmr.delay(1000000)
Last edited by Andy1 on Sun Dec 13, 2015 4:03 am, edited 2 times in total.
User avatar
By Andy1
#36310 Any help would be appreciated..
I now prepared a second unit and the results are identical.

So basically:
The LED works but I get no SSID, unit is unresponsive when trying to access it with ESPlorer
Reflash firmware and the SSID works (!)
Add init.lua and it starts all over again.
User avatar
By xtal
#36328 NodeMCU/LUA large timer delays >10 ms can kill your wifi stuff.
Try reading the unoffical FAQ , it may answer some questions.
NodeMCU/LUA depends largely on CallBacks [ie]
exe inst 1 ~~~~~~~~ need CB [ie] execute this CB code when CB occurs
\exe more insts
\exe more insts
\exe more insts
-----------------> CB for inst1 can occur anytime
User avatar
By Andy1
#36345 Thank you. You correctly identified the problem.
I converted it to a function and tmr.alarm and now it works great.
Kudos.