- diverses modifications lors du dernier workshop ;-)
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user