From 3bfc2949d2a193970e48e8a9044a8ac749e4580e Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Tue, 13 Nov 2018 20:44:42 +0100 Subject: [PATCH] =?UTF-8?q?-=20test=C3=A9=20le=20mode=20deep=20sleep=20ave?= =?UTF-8?q?c=20dsleep.lua=20-=20fait=20un=20petit=20ping=20avec=20ping.lua?= =?UTF-8?q?=20pour=20tester=20si=20une=20machine=20est=20pr=C3=A9sente?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LED_WS2812/Alex/PoC/just_test_3x.lua | 18 +++-- LED_WS2812/Alex/PoC/just_test_6x.lua | 21 ++++++ LED_WS2812/Alex/PoC/webleds.lua | 2 +- LED_WS2812/Alex2/PoC.tar | Bin 0 -> 8192 bytes LED_WS2812/Alex2/PoC/cat.lua | 17 +++++ LED_WS2812/Alex2/PoC/dir.lua | 15 +++++ .../Alex2/PoC/dossier sans titre/initz.lua | 15 +++++ LED_WS2812/Alex2/PoC/index.html | 60 +++++++++++++++++ LED_WS2812/Alex2/PoC/initz.lua | 23 +++++++ LED_WS2812/Alex2/PoC/just_test_3x.lua | 23 +++++++ LED_WS2812/Alex2/PoC/just_test_6x.lua | 21 ++++++ LED_WS2812/Alex2/PoC/rm_files.lua | 12 ++++ LED_WS2812/Alex2/PoC/start_boot.lua | 8 +++ LED_WS2812/Alex2/PoC/webleds.lua | 63 ++++++++++++++++++ LED_WS2812/Alex2/PoC/wifiap.lua | 18 +++++ Wifi/dsleep.lua | 18 +++++ Wifi/ping.lua | 29 ++++++++ Wifi/wifi_cli_conf.lua | 2 +- make_ping.lua | 20 ++++++ 19 files changed, 377 insertions(+), 8 deletions(-) create mode 100644 LED_WS2812/Alex/PoC/just_test_6x.lua create mode 100644 LED_WS2812/Alex2/PoC.tar create mode 100644 LED_WS2812/Alex2/PoC/cat.lua create mode 100644 LED_WS2812/Alex2/PoC/dir.lua create mode 100644 LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua create mode 100644 LED_WS2812/Alex2/PoC/index.html create mode 100644 LED_WS2812/Alex2/PoC/initz.lua create mode 100644 LED_WS2812/Alex2/PoC/just_test_3x.lua create mode 100644 LED_WS2812/Alex2/PoC/just_test_6x.lua create mode 100644 LED_WS2812/Alex2/PoC/rm_files.lua create mode 100644 LED_WS2812/Alex2/PoC/start_boot.lua create mode 100644 LED_WS2812/Alex2/PoC/webleds.lua create mode 100644 LED_WS2812/Alex2/PoC/wifiap.lua create mode 100644 Wifi/dsleep.lua create mode 100644 Wifi/ping.lua create mode 100644 make_ping.lua diff --git a/LED_WS2812/Alex/PoC/just_test_3x.lua b/LED_WS2812/Alex/PoC/just_test_3x.lua index c04c64a..8059019 100644 --- a/LED_WS2812/Alex/PoC/just_test_3x.lua +++ b/LED_WS2812/Alex/PoC/just_test_3x.lua @@ -2,16 +2,22 @@ -- tout sur la couleur: https://www.w3schools.com/colors/default.asp -- roue des couleurs: https://iro.js.org/?ref=oldsite -print("\n just_test_3x.lua zf181105.1428 \n") +print("\n just_test_3x.lua zf181106.0940 \n") print("Initializing LED strip...") ws2812.init() ws2812_effects.stop() strip_buffer = ws2812.newBuffer(3, 3) -ws2812.write(string.char(0, 255, 0, 255, 0, 0, 0, 0, 255)) -ws2812.write(string.char(255, 0, 255, 0, 255, 255, 255, 255, 0)) -ws2812.write(string.char(128, 255, 64, 255, 200, 200, 200, 200, 255)) -ws2812.write(string.char(255, 255, 255, 40, 40, 40, 5, 5, 5)) -ws2812.write(string.char(0, 0, 0, 0, 0, 0, 0, 0, 0)) +ws2812.write(string.char(255, 0, 0, 0, 255, 0, 0, 0, 255)) -- RGB natural + +ws2812.write(string.char(0, 255, 0, 0, 0, 255, 255, 0, 0)) -- GBR WS2813 +ws2812.write(string.char(0, 255, 0, 255, 0, 0, 0, 0, 255)) -- GRB WS2812 + +ws2812.write(string.char(255, 0, 255, 255, 255, 0, 0, 255, 255)) -- CMY en GBR WS2813! +ws2812.write(string.char(255, 0, 255, 0, 255, 255, 255, 255, 0)) -- CMY en GRB WS2812! + +ws2812.write(string.char(128, 255, 64, 255, 200, 200, 200, 200, 255)) +ws2812.write(string.char(255, 255, 255, 40, 40, 40, 5, 5, 5)) +ws2812.write(string.char(0, 0, 0, 0, 0, 0, 0, 0, 0)) diff --git a/LED_WS2812/Alex/PoC/just_test_6x.lua b/LED_WS2812/Alex/PoC/just_test_6x.lua new file mode 100644 index 0000000..9c8abe0 --- /dev/null +++ b/LED_WS2812/Alex/PoC/just_test_6x.lua @@ -0,0 +1,21 @@ +-- Scripts juste pour tester 6x LED RGB +-- tout sur la couleur: https://www.w3schools.com/colors/default.asp +-- roue des couleurs: https://iro.js.org/?ref=oldsite + +print("\n just_test_3x.lua zf181106.1458 \n") + + +print("Initializing LED strip...") +ws2812.init() +ws2812_effects.stop() +strip_buffer = ws2812.newBuffer(6, 3) +ws2812.write(string.char(255, 0, 0, 0, 255, 0, 0, 0, 255)) -- RGB positionnement naturel + +ws2812.write(string.char(0, 255, 0, 0, 0, 255, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- GBR and CMY en GBR WS2813! + +ws2812.write(string.char(0, 255, 0, 0, 0, 255/3, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- vert compensé GBR and CMY en GBR WS2813! + +ws2812.write(string.char(128, 255, 128, 200, 200, 255, 255, 200, 200, 255, 255, 255, 40, 40, 40, 5, 5, 5)) -- White RGB & White 100/50/10% + +ws2812.write(string.char(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) -- LED OFF + diff --git a/LED_WS2812/Alex/PoC/webleds.lua b/LED_WS2812/Alex/PoC/webleds.lua index 6ef5da6..81bd992 100644 --- a/LED_WS2812/Alex/PoC/webleds.lua +++ b/LED_WS2812/Alex/PoC/webleds.lua @@ -7,7 +7,7 @@ dofile('wifiap.lua') -- LED init (strip with 72 leds) print("Initializing LED strip...") ws2812.init() -strip_buffer = ws2812.newBuffer(3, 3) +strip_buffer = ws2812.newBuffer(6, 3) ws2812_effects.init(strip_buffer) -- initially all leds off ws2812_effects.set_speed(200) diff --git a/LED_WS2812/Alex2/PoC.tar b/LED_WS2812/Alex2/PoC.tar new file mode 100644 index 0000000000000000000000000000000000000000..c782384b41db659b6ab6a8bae4d874e1d81e07cd GIT binary patch literal 8192 zcmeGg{cqd0GC%9Dxar{~a%)Sn9LIgG?XAhWtiXT;O|XZzzQK?s$|fRF8cEx6i|%jV z9Vxj^(>2M^3K^rbAqHd6 z>tX!=l9)VH{Ljjhhx6!{<2?H6+aFIZ{&)5g=nPDpQM0f(#V5^m&L%&+{1(o&$3l1Mbb@>{rARwTnU``1|4Pm0x%1v} z7TpgzSi&9=8c_5xC_1b`!4uF6uAqo@vS11hBx)t%14y~5@_3`*N#J}_u$0H363Li= zSft=})@*jkb*JE>ld=_0Sf}DwEbquz^KuAL%ZS{%rgn~1%t{A%k4DvMUxObR?P|Ey z{Tlr68EH>&w0jiPaTo;)8#oe*VHqvDCVChJj9y}+2UR?0h}ks=(d1-NmWrWGz_N@b zdWf(HgTJKnkn_nXhJ|F=*bTl`Oph(nzFo#L=3-W^r^zPCnLBxHAK`=^M?pLp1<2uc zHhC;nDW)okg<#U1{9vBp+&ap_KuX}Jek!ez2l)1)kBSVor0 zot&5*Op|(Nhgm@G#DGMTGoD;RjM1R;`*~j*oP9Zt`u+X+INYC&L-a9Aclh26P(u_V z2@x8iQ#!YICL>8mN-kM`-jR(ktDzNVDF3_Q`fjA8XKmVXj`_W#W$m=U9%uBGDN@dt ztAGD=PF!&9=gasZ{cubF4}0OD?*CC3_Gtb)8Vth6{{N6MX?Q!85k8b@MWbbI5qk)DWThn11>>SHvkRC0w>w$N?J-m&(gqke1l0z{xHyiltBrybI_`4TE6L^gnX)2THfsmx ztYRHY7R>T;78J44Oa_>ZQ+5>>6&8j7k5*hwbvd8sY+7+aZN_m>ps6vi<{5`1=S*n8 zit*wM3KW6xZHgm;g%c%a`7R)?>P=!u_YNHt<dv6bas4grYr#=!VfD z%r=^-ubhUZVK+6^+eWo*IE%PoEo=@vGmm~*G2syw0ove7w?)zf^$(D&VzD+q0c;Z@ z!M6S2Ju~$V{x9&P5Uycq)Y_8Mrj|%_ayWq z0AbS~xe3oX+9p>_I!dn4dcm}h*Th(}bF=Ny#>L4Qo-DZF}o5PXV>bV zzPvyl@8~LQr5ojcyD8g_7GP$J+OoO1wR=QChW&f}v^DnL#GSWc=RZ?4asLS(AUl2# zcbKBEHTTcQD9&78hIHt$?0FHyEJv9W?u`FdSB`0!TK z6az#cownJ96#80fwICVR$xY5NgXuqGs-!M#d+DE_A#S6*W&R8MQ8WK_!yf*o_rG{0 ze4PJobLFb=z4-S|0n1`K)B+s$J(yP?^MXSmAS7#8Xsq`IPNI%B+f(1@B zI8lW3z0(g(mBCuw=!Lv^<+bXTwcD}mwbMPVYc;CCMONC$kE&s=SY0zM=E1A8AsnGu(o5;GqCu=Krlw|mxXFHjxID6W^uVJB9zF2T9{3%rSeJqT literal 0 HcmV?d00001 diff --git a/LED_WS2812/Alex2/PoC/cat.lua b/LED_WS2812/Alex2/PoC/cat.lua new file mode 100644 index 0000000..7c309b9 --- /dev/null +++ b/LED_WS2812/Alex2/PoC/cat.lua @@ -0,0 +1,17 @@ +-- fonction cat() pour afficher le contenu d'un fichier dans la flash +print("\n cat.lua zf180826.1109 \n") + +function cat(zfile) + print("\n"..zfile.."\n-------------------------------") + + zfilei = file.open(zfile, "r") + i=1 + zline=file.readline() + repeat + print(i..": "..string.sub(zline,1,string.len(zline)-1)) + i=i+1 zline=file.readline() + until zline== nil + file.close(zfilei) + + print("-------------------------------") +end diff --git a/LED_WS2812/Alex2/PoC/dir.lua b/LED_WS2812/Alex2/PoC/dir.lua new file mode 100644 index 0000000..8bf9414 --- /dev/null +++ b/LED_WS2812/Alex2/PoC/dir.lua @@ -0,0 +1,15 @@ +-- fonction dir() pour afficher les fichiers dans la flash +print("\n dir.lua zf180826.1019 \n") + +function dir() + print("\n-------------------------------") + l=file.list() i=0 + for k,v in pairs(l) do + i=i+v + print(k..string.rep(" ",19-string.len(k)).." : "..v.." bytes") + end + print("-------------------------------") + print('\nUsed: '..i..' bytes\nusage: dofile("file.lua")\n') +end + +dir() diff --git a/LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua b/LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua new file mode 100644 index 0000000..17beb40 --- /dev/null +++ b/LED_WS2812/Alex2/PoC/dossier sans titre/initz.lua @@ -0,0 +1,15 @@ + +print() +print("starting init.lua...") +print() +print("local files:") +l=file.list() +for k,v in pairs(l) do + print(k.." "..v) +end +print() + +print("starting webleds...") +print() +dofile('webleds.lua') + diff --git a/LED_WS2812/Alex2/PoC/index.html b/LED_WS2812/Alex2/PoC/index.html new file mode 100644 index 0000000..62283da --- /dev/null +++ b/LED_WS2812/Alex2/PoC/index.html @@ -0,0 +1,60 @@ + + + +LED Strip Control + + + + +

LED strip control page

+ +

Choose an effect:

+ + +

Pick a color:

+ + + + + diff --git a/LED_WS2812/Alex2/PoC/initz.lua b/LED_WS2812/Alex2/PoC/initz.lua new file mode 100644 index 0000000..97951ca --- /dev/null +++ b/LED_WS2812/Alex2/PoC/initz.lua @@ -0,0 +1,23 @@ +--Script de bootstrap, en appuyant sur le bouton ça démarre start_boot, +-- autrement en attendant 8 secondes cela démarre start_boot + +print("\n init.lua zf181017.1026\n") + +zswitch=3 --switch flash +gpio.mode(zswitch, gpio.INT, gpio.PULLUP) +initalarme=tmr.create() + +function hvbouton() + gpio.trig(zswitch, "none") + tmr.unregister(initalarme) + dofile("start_boot.lua") +-- dofile("start_job.lua") +end + +gpio.trig(zswitch, "both", hvbouton) + +tmr.alarm(initalarme, 8000, tmr.ALARM_SINGLE, function() + print("\nStart\n") + dofile("start_boot.lua") +-- dofile("start_job.lua") +end) diff --git a/LED_WS2812/Alex2/PoC/just_test_3x.lua b/LED_WS2812/Alex2/PoC/just_test_3x.lua new file mode 100644 index 0000000..8059019 --- /dev/null +++ b/LED_WS2812/Alex2/PoC/just_test_3x.lua @@ -0,0 +1,23 @@ +-- Scripts juste pour tester 3x LED RGB +-- tout sur la couleur: https://www.w3schools.com/colors/default.asp +-- roue des couleurs: https://iro.js.org/?ref=oldsite + +print("\n just_test_3x.lua zf181106.0940 \n") + + +print("Initializing LED strip...") +ws2812.init() +ws2812_effects.stop() +strip_buffer = ws2812.newBuffer(3, 3) +ws2812.write(string.char(255, 0, 0, 0, 255, 0, 0, 0, 255)) -- RGB natural + +ws2812.write(string.char(0, 255, 0, 0, 0, 255, 255, 0, 0)) -- GBR WS2813 +ws2812.write(string.char(0, 255, 0, 255, 0, 0, 0, 0, 255)) -- GRB WS2812 + +ws2812.write(string.char(255, 0, 255, 255, 255, 0, 0, 255, 255)) -- CMY en GBR WS2813! +ws2812.write(string.char(255, 0, 255, 0, 255, 255, 255, 255, 0)) -- CMY en GRB WS2812! + +ws2812.write(string.char(128, 255, 64, 255, 200, 200, 200, 200, 255)) +ws2812.write(string.char(255, 255, 255, 40, 40, 40, 5, 5, 5)) +ws2812.write(string.char(0, 0, 0, 0, 0, 0, 0, 0, 0)) + diff --git a/LED_WS2812/Alex2/PoC/just_test_6x.lua b/LED_WS2812/Alex2/PoC/just_test_6x.lua new file mode 100644 index 0000000..9c8abe0 --- /dev/null +++ b/LED_WS2812/Alex2/PoC/just_test_6x.lua @@ -0,0 +1,21 @@ +-- Scripts juste pour tester 6x LED RGB +-- tout sur la couleur: https://www.w3schools.com/colors/default.asp +-- roue des couleurs: https://iro.js.org/?ref=oldsite + +print("\n just_test_3x.lua zf181106.1458 \n") + + +print("Initializing LED strip...") +ws2812.init() +ws2812_effects.stop() +strip_buffer = ws2812.newBuffer(6, 3) +ws2812.write(string.char(255, 0, 0, 0, 255, 0, 0, 0, 255)) -- RGB positionnement naturel + +ws2812.write(string.char(0, 255, 0, 0, 0, 255, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- GBR and CMY en GBR WS2813! + +ws2812.write(string.char(0, 255, 0, 0, 0, 255/3, 255, 0, 0, 255, 0, 255, 255, 255, 0, 0, 255, 255)) -- vert compensé GBR and CMY en GBR WS2813! + +ws2812.write(string.char(128, 255, 128, 200, 200, 255, 255, 200, 200, 255, 255, 255, 40, 40, 40, 5, 5, 5)) -- White RGB & White 100/50/10% + +ws2812.write(string.char(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)) -- LED OFF + diff --git a/LED_WS2812/Alex2/PoC/rm_files.lua b/LED_WS2812/Alex2/PoC/rm_files.lua new file mode 100644 index 0000000..81241cb --- /dev/null +++ b/LED_WS2812/Alex2/PoC/rm_files.lua @@ -0,0 +1,12 @@ +-- pour effacer TOUS les fichiers qui se trouve dans la flash du NodeMCU + +print("\n rm_files.lua zf180907.1511 \n") + + +l=file.list() i=0 +for k,v in pairs(l) do + i=i+v + file.remove(k) +end +print("-------------------------------") +print("\nC'est tout effaced :-) \n") diff --git a/LED_WS2812/Alex2/PoC/start_boot.lua b/LED_WS2812/Alex2/PoC/start_boot.lua new file mode 100644 index 0000000..c651d1d --- /dev/null +++ b/LED_WS2812/Alex2/PoC/start_boot.lua @@ -0,0 +1,8 @@ +-- Scripts à charger au moment du boot + +print("\n start_boot.lua zf181105.1122 \n") + +print("starting webleds...") +print() +dofile('webleds.lua') + diff --git a/LED_WS2812/Alex2/PoC/webleds.lua b/LED_WS2812/Alex2/PoC/webleds.lua new file mode 100644 index 0000000..81bd992 --- /dev/null +++ b/LED_WS2812/Alex2/PoC/webleds.lua @@ -0,0 +1,63 @@ +-- initially based on https://github.com/nodemcu/nodemcu-firmware/blob/master/lua_examples/webap_toggle_pin.lua + +-- start wifi client or AP mode +--dofile('wificlient.lua') +dofile('wifiap.lua') + +-- LED init (strip with 72 leds) +print("Initializing LED strip...") +ws2812.init() +strip_buffer = ws2812.newBuffer(6, 3) +ws2812_effects.init(strip_buffer) +-- initially all leds off +ws2812_effects.set_speed(200) +ws2812_effects.set_brightness(0) +ws2812_effects.set_color(0,0,0) +ws2812_effects.start() +print("done.") +print() + +-- helper functions +-- send a file from memory to the client; max. line length = 1024 bytes! +function send_file(client, filename) + if file.open(filename, "r") then + repeat + local line=file.read('\n') + if line then + client:send(line) + end + until not line + file.close() + end +end + +-- web server +srv = net.createServer(net.TCP) +srv:listen(80, function(conn) + conn:on("receive", function(client, request) + local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP") + if (method == nil) then + _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP") + end + local _GET = {} + if (vars ~= nil) then + for k, v in string.gmatch(vars, "(%w+)=([a-z0-9_]+)&*") do + _GET[k] = v + end + end + if (_GET.set == "effect") then + print("setting effect", _GET.effect) + ws2812_effects.set_mode(_GET.effect) + ws2812_effects.set_speed(200) + ws2812_effects.set_brightness(50) + ws2812_effects.start() + end + if (_GET.set == "color") then + print("setting color (RGB)", _GET.r, _GET.g, _GET.b) + ws2812_effects.set_color(_GET.g, _GET.r, _GET.b) -- obviously our strip is GRB and not RGB + end + send_file(client, 'index.html') + end) + conn:on("sent", function(c) c:close() end) +end) + diff --git a/LED_WS2812/Alex2/PoC/wifiap.lua b/LED_WS2812/Alex2/PoC/wifiap.lua new file mode 100644 index 0000000..13f559a --- /dev/null +++ b/LED_WS2812/Alex2/PoC/wifiap.lua @@ -0,0 +1,18 @@ + +-- set AP mode +wifi.setmode(wifi.SOFTAP) +wifi.ap.config({ ssid = "webleds", pwd = "12345678" }) +print("Started AP mode") + +-- get and display our IP addr. +tmr.alarm(0, 1000, 1, function() + if wifi.ap.getip() == nil then + print("Getting AP info...") + else + print('IP: ', wifi.ap.getip()) + tmr.stop(0) + end +end) + +print() + diff --git a/Wifi/dsleep.lua b/Wifi/dsleep.lua new file mode 100644 index 0000000..799d3c5 --- /dev/null +++ b/Wifi/dsleep.lua @@ -0,0 +1,18 @@ +-- Teste le deep sleep ! +-- s'endore pendant 3 secondes après 8 secondes +-- à mettre à la place du init.lua +-- ATTENTION: il faut connecter la pin 0 à la pin RESET ! + +print("\n dsleep.lua zf181113.2040 \n") + +_, reset_reason = node.bootreason() +print("reset_reason: ",reset_reason) +if reset_reason == 4 then print("Coucou, soft reset...") end +if reset_reason == 5 then print("Coucou, je suis réveillé...") end +if reset_reason == 6 then print("Coucou, hard reset...") end + +ztmr_SLEEP = tmr.create() +tmr.alarm(ztmr_SLEEP, 8000, tmr.ALARM_SINGLE, function () + print("Je dors...") + node.dsleep(3000000) +end) diff --git a/Wifi/ping.lua b/Wifi/ping.lua new file mode 100644 index 0000000..76c13b4 --- /dev/null +++ b/Wifi/ping.lua @@ -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") + + diff --git a/Wifi/wifi_cli_conf.lua b/Wifi/wifi_cli_conf.lua index d3cd11e..2ed3fe9 100644 --- a/Wifi/wifi_cli_conf.lua +++ b/Wifi/wifi_cli_conf.lua @@ -1,4 +1,4 @@ -- Petit script pour configurer le client WIFI du NodeMCU print("\n wifi_cli_conf.lua zf180824.2000 \n") -wifi.sta.config{ssid="Hugo", pwd="tototutu", save=true} +wifi.sta.config{ssid="apzuzu6", pwd="12234567", save=true} diff --git a/make_ping.lua b/make_ping.lua new file mode 100644 index 0000000..e11c200 --- /dev/null +++ b/make_ping.lua @@ -0,0 +1,20 @@ +-- programme pour faire des ping en permanence + +print("\n make_ping.lua zf181113.1947 \n") + +zLED=0 +gpio.mode(zLED, gpio.OUTPUT) +ztmr_LED = tmr.create() +value = true + +dofile("ping.lua") + +tmr.alarm(ztmr_LED, 500, tmr.ALARM_AUTO, function () + if value then + gpio.write(zLED, gpio.HIGH) + else + gpio.write(zLED, gpio.LOW) + Ping("192.168.0.102") + end + value = not value +end)