Merge f24e6f9d44
into 1dc8d73a08
commit
3b137652bf
|
@ -18,6 +18,9 @@ html = """<!DOCTYPE html>
|
||||||
<head> <title>Pico W</title> </head>
|
<head> <title>Pico W</title> </head>
|
||||||
<body> <h1>Pico W</h1>
|
<body> <h1>Pico W</h1>
|
||||||
<p>%s</p>
|
<p>%s</p>
|
||||||
|
<a href="/light/off">Turn off</a>
|
||||||
|
<br>
|
||||||
|
<a href="/light/on">Turn on</a>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
"""
|
"""
|
||||||
|
@ -40,10 +43,12 @@ else:
|
||||||
addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
|
addr = socket.getaddrinfo('0.0.0.0', 80)[0][-1]
|
||||||
|
|
||||||
s = socket.socket()
|
s = socket.socket()
|
||||||
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
s.bind(addr)
|
s.bind(addr)
|
||||||
s.listen(1)
|
s.listen(1)
|
||||||
|
|
||||||
print('listening on', addr)
|
print('listening on', addr)
|
||||||
|
stateis = "LED is ?"
|
||||||
|
|
||||||
# Listen for connections
|
# Listen for connections
|
||||||
while True:
|
while True:
|
||||||
|
@ -77,4 +82,4 @@ while True:
|
||||||
|
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
cl.close()
|
cl.close()
|
||||||
print('connection closed')
|
print('connection closed')
|
||||||
|
|
Ładowanie…
Reference in New Issue