Saataa andagii !
This commit is contained in:
parent
8ac9dac055
commit
934e97a709
3 changed files with 22 additions and 1 deletions
|
@ -9,4 +9,8 @@ printTemp()
|
|||
-- dice()
|
||||
|
||||
-- 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
16
mqtt.lua
Normal 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)
|
||||
|
1
web.lua
1
web.lua
|
@ -6,3 +6,4 @@ nb = 0
|
|||
net.wf.setup(net.wf.mode.AP, "ESP32 Pierre", "sandwich134")
|
||||
net.wf.start()
|
||||
net.service.http.start()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue