def run(): #p = pitch() # Setup Socket WebServer s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(('', 80)) s.listen(5) while True: conn, addr = s.accept() print("Got a connection from %s" % str(addr)) request = conn.recv(1024) print("Content = %s" % str(request)) request = str(request) LEFTON = request.find('/?LEFT=ON') RIGHTON = request.find('/?RIGHT=ON') MIDDLEON = request.find('/?MIDDLE=ON') FORWARD = request.find('/?FORWARD=ON') STOP = request.find('/?STOP=ON') UP = request.find('/?UP=ON') DOWN = request.find('/?DOWN=ON') direction = 'STOP' left_on = False right_on = False if LEFTON == 6: fin.low() if RIGHTON == 6: fin.high() if MIDDLEON == 6: fin.mean() if STOP == 6: fin.off() if FORWARD == 6: fin.swim(1, 0.5) if UP == 6: pass if DOWN == 6: pass cm.feedback(conn, html) conn.close()
command, value = reqparam.split("=") if command == 'SPEED': # left, right = value.split('.') #print (left, right) #print ("SPEED") #led.blink(4) pass elif command == 'FORWARD': #print ("FORWARD") #led.blink(2) pass elif command == 'BACKWARD': #print ("BACKWARD") #led.blink(3) pass cm.feedback(conn, html) conn.close()