Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- This module implements a simple web-server to allow configuration changes via Wi-Fi.
- -- Please be careful! Since it's just an example of working with ESP module, it has no access control at all (to keep things simple).
- local atmega = require "atmega"
- sv = net.createServer(net.TCP, 30)
- local function close_connection(c)
- c:close()
- end
- function receiver(sck, data)
- print(data)
- sck:close()
- end
- if sv then
- sv:listen(5000, function(conn)
- conn:on("receive", receiver)
- local stuff = atmega.getMessage()
- if stuff == nil then
- stuff = "fail"
- end
- local test = "test 1 " .. stuff
- conn:send(test, close_connection)
- end)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement