From a8c4ba5899aae9bb94ad9131b7d23147b95f5569 Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Mon, 12 Aug 2019 13:47:03 +0200 Subject: [PATCH] =?UTF-8?q?Corrig=C3=A9=20le=20bug=20du=20timer=20encore?= =?UTF-8?q?=20une=20fois=20dans=20mon=20workshop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Workshop/181015/btn_led_remote/led/initz.lua | 6 +++--- Workshop/181015/btn_led_remote/led/web_led_onoff.lua | 2 ++ Workshop/181015/btn_led_remote/led/wifi_cli_conf.lua | 5 +++++ Workshop/181015/btn_led_remote/led/wifi_get_ip.lua | 6 +++--- 4 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 Workshop/181015/btn_led_remote/led/wifi_cli_conf.lua diff --git a/Workshop/181015/btn_led_remote/led/initz.lua b/Workshop/181015/btn_led_remote/led/initz.lua index 97951ca..8a34525 100644 --- a/Workshop/181015/btn_led_remote/led/initz.lua +++ b/Workshop/181015/btn_led_remote/led/initz.lua @@ -1,7 +1,7 @@ --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") +print("\n init.lua zf190808.1537\n") zswitch=3 --switch flash gpio.mode(zswitch, gpio.INT, gpio.PULLUP) @@ -9,14 +9,14 @@ initalarme=tmr.create() function hvbouton() gpio.trig(zswitch, "none") - tmr.unregister(initalarme) + initalarme:unregister() dofile("start_boot.lua") -- dofile("start_job.lua") end gpio.trig(zswitch, "both", hvbouton) -tmr.alarm(initalarme, 8000, tmr.ALARM_SINGLE, function() +initalarme:alarm(8000, tmr.ALARM_SINGLE, function() print("\nStart\n") dofile("start_boot.lua") -- dofile("start_job.lua") diff --git a/Workshop/181015/btn_led_remote/led/web_led_onoff.lua b/Workshop/181015/btn_led_remote/led/web_led_onoff.lua index 041c760..ff1c1b7 100644 --- a/Workshop/181015/btn_led_remote/led/web_led_onoff.lua +++ b/Workshop/181015/btn_led_remote/led/web_led_onoff.lua @@ -45,6 +45,8 @@ srv:listen(80, function(conn) elseif (_GET.pin == "OFF") then _off = " selected=\"true\"" gpio.write(zLED, gpio.HIGH) + elseif (_GET.pin == "zuzu") then + print("hello zuzu") end buf = buf .. "OFFON" client:send(buf) diff --git a/Workshop/181015/btn_led_remote/led/wifi_cli_conf.lua b/Workshop/181015/btn_led_remote/led/wifi_cli_conf.lua new file mode 100644 index 0000000..9f1326e --- /dev/null +++ b/Workshop/181015/btn_led_remote/led/wifi_cli_conf.lua @@ -0,0 +1,5 @@ +-- Petit script pour configurer le client WIFI du NodeMCU +print("\n wifi_cli_conf.lua zf190808.1559 \n") + +wifi.sta.config{ssid="3g-s7", pwd="12234567", save=true} + diff --git a/Workshop/181015/btn_led_remote/led/wifi_get_ip.lua b/Workshop/181015/btn_led_remote/led/wifi_get_ip.lua index 83b6369..d166aed 100644 --- a/Workshop/181015/btn_led_remote/led/wifi_get_ip.lua +++ b/Workshop/181015/btn_led_remote/led/wifi_get_ip.lua @@ -1,12 +1,12 @@ -- Petit script pour obtenir l'adresse IP du NodeMCU connecté sur un AP Wifi -print("\n wifi_get_ip.lua zf180824.2000 \n") +print("\n wifi_get_ip.lua zf190808.1600 \n") wifitimer1=tmr.create() -tmr.alarm(wifitimer1, 1000, tmr.ALARM_AUTO , function() +wifitimer1:alarm(1000, tmr.ALARM_AUTO , function() if wifi.sta.getip() == nil then print("Connecting to AP...") else - tmr.stop(wifitimer1) + wifitimer1:stop() dofile("wifi_info.lua") end end)