diff options
author | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-02 23:52:52 +0200 |
---|---|---|
committer | Trygve Laugstøl <trygvis@inamo.no> | 2015-10-03 17:15:23 +0200 |
commit | 1d8bec95253ee8a88a85cb88be521f28b23504aa (patch) | |
tree | 5d61cd1d4f091286a4b423523bbb56b492b8022e /mqtt-bridge/wlan.lua | |
download | esp-playground-1d8bec95253ee8a88a85cb88be521f28b23504aa.tar.gz esp-playground-1d8bec95253ee8a88a85cb88be521f28b23504aa.tar.bz2 esp-playground-1d8bec95253ee8a88a85cb88be521f28b23504aa.tar.xz esp-playground-1d8bec95253ee8a88a85cb88be521f28b23504aa.zip |
wip of serial commands to mqtt bridge.
Diffstat (limited to 'mqtt-bridge/wlan.lua')
-rw-r--r-- | mqtt-bridge/wlan.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mqtt-bridge/wlan.lua b/mqtt-bridge/wlan.lua new file mode 100644 index 0000000..03fd923 --- /dev/null +++ b/mqtt-bridge/wlan.lua @@ -0,0 +1,18 @@ +local function is_connected() + local ipAddr = wifi.sta.getip() + return ipAddr ~= nil and ipAddr ~= "0.0.0.0" +end + +function wlan_init() + print("WLAN: Configuring") + + wifi.setmode(wifi.STATION) + wifi.sta.config("", "") + + repeat + tmr.wdclr() + until (is_connected()) + + local ip = wifi.sta.getip() + print("WLAN: Configured, ip="..ip) +end |