Andrew Scheller 2025-03-18 14:00:04 +00:00 zatwierdzone przez GitHub
commit 3b137652bf
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 6 dodań i 1 usunięć

Wyświetl plik

@ -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')