- diverses modifications lors du dernier workshop ;-)

This commit is contained in:
Christian Zufferey
2018-10-24 19:10:10 +02:00
parent de6f67c85c
commit 1adc3051de
3 changed files with 21 additions and 3 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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 .. "</body></html>"
end
function html_status()
buf = "<!DOCTYPE html><html><body><meta charset='utf-8' name='viewport' content='width=device-width, initial-scale=1.0'>\n"
buf = buf .. "<h1>Hello, this is NodeMCU. 1608 </h1>\n"
buf = buf .. "Toto\n"
if gpio.read(zLED) == 1 then
buf = buf .. "<p>Led is off</p>\n"
else
buf = buf .. "<p>Led is on</p>\n"
end
buf = buf .. "</body></html>"
end