WIFI batteri Monitor System - ESP8266 (6 / 9 steg)
Steg 6: BMS webb Server Interface
SRV=net.createServer (net. TCP)
SRV:listen(80,
function(Conn)
Conn:on("Receive",function(Conn,Payload)
--Print(Payload)
Conn: send("HTTP/1.1 200 OK\n\n")
Conn: send("<META HTTP-EQUIV=\"REFRESH\"CONTENT=\"5\">")
Conn: send("<html><title>Battery Live Monitor System-ESP8266</title><body>")
Conn: send("<h1>Battery Live Monitor System-ESP8266</h1><BR>")
Conn: send("Voltage:<B><font color=red size=4>"
.. string.format("%g",adcV).." V < / font >< /b >< br > ")
Conn: send("Current:<B><font color=blue size=4>"
.. string.format("%g",adcI).."mA < / font >< /b >< br >")
Conn: send("Power:<B><font color=red size=4>"
.. string.format("%g",PWR).."mW < / font >< /b >< br >")
Conn: send("Energy:<B><font color=green size=4>"
.. string.format("%g",CPCT).." WH < / font >< /b >< br > ")
Conn: send("<BR><BR><BR>Node.HEAP: <b>".. node.heap().. "< /b >< BR >")
Conn: send("IP ADDR:<b>".. wifi.sta.getip().. "< /b >< BR >")
Conn: send("TMR. NU: < b > "... TMR.Now()... "< /b >< BR < BR >< BR >")
Conn: send("</html></body>")
Conn:on("sent",function(Conn) conn: close() slutet)
Conn = noll
avsluta)
avsluta)