From 1adc3051de53215d163e18433c0adb8ce30bb97e Mon Sep 17 00:00:00 2001 From: Christian Zufferey Date: Wed, 24 Oct 2018 19:10:10 +0200 Subject: [PATCH] - diverses modifications lors du dernier workshop ;-) --- Workshop/181015/blink_led2.lua | 3 ++- Workshop/181015/web_srv/web_get.lua | 8 +++++++- Workshop/181015/web_srv/web_html.lua | 13 ++++++++++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Workshop/181015/blink_led2.lua b/Workshop/181015/blink_led2.lua index 70fa251..7115b63 100644 --- a/Workshop/181015/blink_led2.lua +++ b/Workshop/181015/blink_led2.lua @@ -1,6 +1,6 @@ -- programme pour faire clignoter une LED version simplifiée -print("\n blink_led2.lua zf181015.1138 \n") +print("\n blink_led2.lua zf181019.2000 \n") zLED=0 gpio.mode(zLED, gpio.OUTPUT) @@ -14,4 +14,5 @@ tmr.alarm(ztmr_LED, 100, tmr.ALARM_AUTO, function () gpio.write(zLED, gpio.LOW) end value = not value + end) diff --git a/Workshop/181015/web_srv/web_get.lua b/Workshop/181015/web_srv/web_get.lua index ddfd1c6..d94ebf9 100644 --- a/Workshop/181015/web_srv/web_get.lua +++ b/Workshop/181015/web_srv/web_get.lua @@ -1,6 +1,6 @@ -- petit script pour la gestion du GET du serveur web -print("\n web_get.lua zf181018.1649 \n") +print("\n web_get.lua zf181019.1130 \n") function web_get() if (_GET.led == "on") then @@ -9,6 +9,12 @@ function web_get() elseif (_GET.led == "off") then led_off() html_home() + elseif (_GET.led == "flash") then + xfois=tonumber(_GET.fois) + blink_LED() + html_home() + elseif (_GET.led == "status") then + html_status() else html_home() end diff --git a/Workshop/181015/web_srv/web_html.lua b/Workshop/181015/web_srv/web_html.lua index b0c6275..06d2e42 100644 --- a/Workshop/181015/web_srv/web_html.lua +++ b/Workshop/181015/web_srv/web_html.lua @@ -1,6 +1,6 @@ -- petit script pour le HTML du serveur web -print("\n web_html.lua zf181018.1621 \n") +print("\n web_html.lua zf181019.1130 \n") --Partie HTML et CSS pour la page web function html_home() @@ -12,3 +12,14 @@ function html_home() buf = buf .. "" end +function html_status() + buf = "\n" + buf = buf .. "

Hello, this is NodeMCU. 1608

\n" + buf = buf .. "Toto\n" + if gpio.read(zLED) == 1 then + buf = buf .. "

Led is off

\n" + else + buf = buf .. "

Led is on

\n" + end + buf = buf .. "" +end