- testé le mode deep sleep avec dsleep.lua

- fait un petit ping avec ping.lua pour tester si une machine est présente
This commit is contained in:
Christian Zufferey
2018-11-13 20:44:42 +01:00
parent 1d839f8aaa
commit 3bfc2949d2
19 changed files with 377 additions and 8 deletions

29
Wifi/ping.lua Normal file
View File

@@ -0,0 +1,29 @@
-- Permet de tester si une adresse IP est active
-- ATTENTION, ne fonctionne seulement s'il y a du réseau !
print("\n ping.lua zf181113.1937 \n")
function Ping(mIP)
t1=tmr.now()
conn=net.createConnection(net.TCP, 0)
conn:connect(1,mIP)
conn:on("disconnection", function(sck, c)
-- on disconnection
t2 = tmr.now()
t3=(t2-t1)/1000/1000
print(t3)
if ((t3)<5) then
--IPCount=IPCount+1
print(mIP.." is active.")
else
print(mIP.." is not active.")
end
t1, t2, t3 = nil
end)
sck, c, conn = nil
collectgarbage()
end
Ping("192.168.0.102")