print("Ready to start soft ap") local str=wifi.ap.getmac(); local ssidTemp=string.format("%s%s%s",string.sub(str,10,11),string.sub(str,13,14),string.sub(str,16,17)); cfg={} cfg.ssid="Sepa_"..ssidTemp; cfg.pwd="[CONTRASEÑA]" wifi.ap.config(cfg) cfg={} cfg.ip="192.168.10.1"; cfg.netmask="255.255.255.0"; cfg.gateway="192.168.10.1"; wifi.ap.setip(cfg); wifi.setmode(wifi.SOFTAP) str=nil; ssidTemp=nil; collectgarbage(); print("Soft AP started") print("Heep:(bytes)"..node.heap()); print("MAC:"..wifi.ap.getmac().."\r\nIP:"..wifi.ap.getip()); srv=net.createServer(net.TCP) srv:listen(80,function(conn) conn:on("receive", function(client,request) local buf = "HTTP/1.1 200 OK\n\n"; local _, _, method, path, vars = string.find(request, "([A-Z]+) (.+)?(.+) HTTP"); if(method == nil)then _, _, method, path = string.find(request, "([A-Z]+) (.+) HTTP"); end local _GET = {} if (vars ~= nil)then for k, v in string.gmatch(vars, "(%w+)=(%w+)&*") do _GET[k] = v end end buf = "\n \n \n \n Sepa Weather Light\n \n \n"; buf = buf.."

Light remote sensor - By Sepa

\n" OSS = 1 SDA_PIN = 6 SCL_PIN = 7 pin = 5 status, temp, humi, temp_dec, humi_dec = dht.read(pin) bmp180 = require("bmp180") bmp180.init(SDA_PIN, SCL_PIN) bmp180.read(OSS) t = bmp180.getTemperature() t = string.format("%.2f", (t/10)); p = bmp180.getPressure() p = string.format("%.2f", (p/100)); temp_w = "
Temperatura: "..t.." deg C\n"; press_w = "
Presion: "..p.." hPa\n" buf = buf.."

Sensor BMP180

\n"; buf = buf..press_w..temp_w ; h = "XX" h = string.format("%.2f", humi); t1 = "XX" t1 = string.format("%.2f", temp); buf = buf.."

Sensor DHT11

\n"; buf = buf.."
Humedad: "..h.."\n"; buf = buf.."
Temperatura: "..t1.."\n"; bmp180 = nil package.loaded["bmp180"]=nil buf = buf.."

By Sepa - www.elblogdesepa.com.ar\n"; buf = buf.."
\n \n"; client:send(buf); client:close(); collectgarbage(); end) end)