Finished server script

parent 51c340a9
......@@ -43,7 +43,10 @@ class HttpRequestHandler(BaseHTTPRequestHandler):
def _control_elem(self, elem):
print('Switching {}'.format(elem['name']))
if (elem['name'].lower() == 'light'):
wiringpi.serialPuts(serial, 'hello')
if (elem['switchedOn']):
wiringpi.serialPuts(serial, chr(0x82))
else:
wiringpi.serialPuts(serial, chr(0x02))
def main():
host = '0.0.0.0'
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment