This commit is contained in:
Lukian 2024-10-30 12:10:58 +01:00
parent 183ab102f2
commit 8ac9dac055
5 changed files with 55 additions and 2 deletions

View file

@ -1,3 +1,7 @@
dofile("buzz.lua")
-- s = sensor.attach("DHT22", pio.GPIO21)
-- tmr.delayms(500)
nets = net.wf.scan(true)
nb = 0
net.wf.setup(net.wf.mode.AP, "ESP32 Pierre", "sandwich134")
net.wf.start()

8
www/buzz.lua Normal file
View file

@ -0,0 +1,8 @@
<html>
<body>
<?lua
buzz(pio.GPIO21, 1000)
?>
</body>
</html>

View file

@ -3,12 +3,36 @@
<title>ESP 32 web page</title>
<link href="style.css" rel="stylesheet"/>
</head>
<body>
<body>
<h1>Hello, world!</h1>
<?lua
nb = nb + 1
console(nb.." Chargements")
print(nb.." Chargements")
?>
</body>
<h1>DHT22</h1>
<?lua
-- print("Temp: "..s:read("temperature").." Humi: "..s:read("humidity"))
?>
<h1>Led</h1>
<iframe name="fd" style="display:none"></iframe>
<form action="ledon.lua" target="fd">
<button type="submit">On</button>
</form>
<form action="ledoff.lua" target="fd">
<button type="submit">Off</button>
</form>
<h1>Buzzer</h1>
<form action="buzz.lua" target="fd">
<button type="submit">Buzz</button>
</form>
<h1>Networks</h1>
<ul>
<?lua
for i=0,#nets do
print("<li>"..nets[i].ssid.."</li>")
end
?>
</ul>
</body>
</html>

8
www/ledoff.lua Normal file
View file

@ -0,0 +1,8 @@
<html>
<body>
<?lua
ledoff()
?>
</body>
</html>

9
www/ledon.lua Normal file
View file

@ -0,0 +1,9 @@
<html>
<body>
<?lua
ledon()
?>
</body>
</html>