scan2.lua:
wifi.setmode(wifi.STATIONAP)
function listap(t) print(tmr.now(), "list", t) end
tmr.alarm(0, 500, 1, function() print(tmr.now(), "alarm") end)
output:
dofile('scan2.lua')
> 6391624 alarm
6891613 alarm
7391647 alarm
wifi.sta.getap(listap)
7891616 alarm
> 8391743 alarm
8891676 alarm
9391687 alarm
9891701 alarm
10025270 list table: 0x3fff6128
10391689 alarm
10891616 alarm
wifi.sta.getap(listap)
11391640 alarm
> 11891730 alarm
12391685 alarm
12891674 alarm
13391685 alarm
13547893 list table: 0x3fff60e8
13891646 alarm
tmr.stop(0)
> wifi.sta.getap(listap)
> 22113567 list table: 0x3fff60c0
dofile('scan2.lua')
> 25694647 alarm
26194658 alarm
wifi.sta.getap(listap)
> 26694676 list nil
27194741 list nil
27694714 list nil
28194694 list nil
28685958 list table: 0x3fff6128
28694613 alarm
29194667 alarm
wifi.sta.getap(listap)
> 29694755 list nil
30194703 list nil
30694690 list nil
31194705 list nil
31648996 list table: 0x3fff6128
31694622 alarm
32194664 alarm
32694654 alarm
tmr.stop(0)
>
"list nil" is printed in tmr.alarm interval.
M