LED is now """ + led_state + """.
"""
return html_page
while True:
# Socket accept()
conn, addr = s.accept()
print("Got connection from %s" % str(addr))
# Socket receive()
request=conn.recv(1024)
print("")
print("")
print("Content %s" % str(request))
# Socket send()
request = str(request)
led_on = request.find('/?LED=1')
led_off = request.find('/?LED=0')
if led_on == 6:
print('LED ON')
print(str(led_on))
led.value(1)
elif led_off == 6:
print('LED OFF')
print(str(led_off))
led.value(0)
response = web_page()
conn.send('HTTP/1.1 200 OK\n')
conn.send('Content-Type: text/html\n')
conn.send('Connection: close\n\n')
conn.sendall(response)
# Socket close()
conn.close()