示例#1
0
                motor.move_forward()
            elif (cmd_data == 'S'):
                motor.move_backwards()
            elif (cmd_data == 'D'):
                motor.move_right()
            elif (cmd_data == 'A'):
                motor.move_left()
            elif (cmd_data == '.'):
                motor.decrease_speed()
            elif (cmd_data == ','):
                motor.increase_speed()
            elif (cmd_data == 'X'):
                break
    except Exception as e:
        print ("Error:" + str(e))
        print ("Waiting for serial connection to reestablish...")
        connection.reconnect()

        # Instruct the Sensorimotor Cortex to stop wandering.
        sensorimotor.reset()

    sys.stdout.flush() # for service to print logs

vst.keeprunning = False
vst.interrupt()
sur.keeprunning = False

# When everything done, release the capture
sock.close()
terminate()