Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SLEEP_TIME = 30 * 1000 * 1000
- function do_spania()
- print("Polaczono")
- print(wifi.sta.getip())
- print("Ide spac na ".. SLEEP_TIME/1000/1000 .."s")
- node.dsleep(SLEEP_TIME)
- end
- local function startup()
- tmr.stop(0)
- if abort == true then --zatrzymaj program
- return
- else --wykonuj program
- if wifi.sta.getip() ~= nil then --juz polaczony do sieci
- do_spania()
- else
- tmr.alarm(1, 500, 1, function()
- if wifi.sta.getip() == nil then
- print("Waiting for IP...")
- else
- tmr.stop(1)
- do_spania()
- end
- end)
- end
- end --koniec warunku zatrzymania programu
- end
- --dofile ("program_DHT22.lua")
- --if wifi.sta.status() ~= 0 then --NOT STATION_IDLE
- -- wifi.sta.disconnect()
- --end
- local abort = false
- local switch = 1
- gpio.mode(switch,gpio.INPUT,gpio.PULLUP)
- GPIO14 = 5
- gpio.mode(GPIO14,gpio.OUTPUT)
- gpio.write(GPIO14,gpio.HIGH)
- wifi.setmode(wifi.STATION)
- wifi.sta.config("SSID","PWD")
- wifi.sta.connect()
- print("Modul uruchomiony")
- print('Czekam na sygnal przerwania')
- tmr.alarm(0,2000,0,startup)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement