- Wed Nov 19, 2014 9:18 am
#2911
I REALLY thought I'd cracked this - but the timer just keeps on ticking.... I can inject tmr.stop() via serial but as shown here as part of the setup... it doesn't stop.... just keeps repeating. Thoughts, anyone.
file.remove("init.lua")
file.open("init.lua","w")
file.writeline([[print("Petes Tester 4")]])
file.writeline([[tmr.alarm(5000, 0, function() dofile("thelot.lua") end )]])
file.close()
file.remove("thelot.lua")
file.open("thelot.lua","w")
file.writeline([[tmr.stop()]])
file.writeline([[connecttoap = function (ssid,pw)]])
file.writeline([[print(wifi.sta.getip())]])
file.writeline([[wifi.setmode(wifi.STATION)]])
file.writeline([[tmr.delay(1000000)]])
file.writeline([[wifi.sta.config(ssid,pw)]])
file.writeline([[tmr.delay(1000000)]])
file.writeline([[print("Connected to ",ssid," as ",wifi.sta.getip())]])
file.writeline([[end]])
file.writeline([[connecttoap("loft-east","xxxxxxxxx")]])
file.close()
Similarly, having stopped the timer, I can run dofile("thelot") manually and that works a treat - as many times as I like. They just don't seem to want to work properly when in the timer function - and you can't use this in the init function directly as the radio does not seem to be turned on until AFTER the init function.