Saataa andagii !

This commit is contained in:
Lukian 2024-12-15 16:54:01 +01:00
parent 8ac9dac055
commit 934e97a709
3 changed files with 22 additions and 1 deletions

View file

@ -9,4 +9,8 @@ printTemp()
-- dice() -- dice()
-- lance l'hotspot wifi et le serveur web -- lance l'hotspot wifi et le serveur web
dofile("web.lua") -- dofile("web.lua")
-- connection au brooker mqtt
dofile("mqtt.lua")

16
mqtt.lua Normal file
View file

@ -0,0 +1,16 @@
client = mqtt.client("ESP32", "192.168.1.76", 1883, false)
client:connect("","")
function printMaster(length, msg)
console("[MASTER]"..msg)
end
function printAlt(length, msg)
console("[ALT]"..msg)
end
client:subscribe("MASTER", mqtt.QOS0, printMaster)
client:subscribe("ALT", mqtt.QOS0, printAlt)
client:publish("MASTER", "Hello, world!", mqtt.QOS0)
client:publish("ALT", "Hello, world!", mqtt.QOS0)

View file

@ -6,3 +6,4 @@ nb = 0
net.wf.setup(net.wf.mode.AP, "ESP32 Pierre", "sandwich134") net.wf.setup(net.wf.mode.AP, "ESP32 Pierre", "sandwich134")
net.wf.start() net.wf.start()
net.service.http.start() net.service.http.start()