Пример #1
0
def haptic_senbay_ver():
    mysocket = SensorDataReceiver.make_mysocket()
    SensorDataReceiver.bind_mysocket(mysocket)
    arduino_serial = SerialConnector.get_connection()
    while True:
        try:
            sensor_data = HapticDataReceiver.receive_sensor_data(mysocket)
            arduino_serial.write(str(sensor_data) + '/')
        except KeyboardInterrupt:
            arduino_serial.close()
            sys.exit()
        except Exception:
            pass
Пример #2
0
 def bicycle_senbay_speed_ver(self):
     mysocket = SensorDataReceiver.make_mysocket()
     SensorDataReceiver.bind_mysocket(mysocket)
     arduino_serial = SerialConnector.get_connection()
     while True:
         try:
             speed = BicycleDataReceiver.receive_speed_data(mysocket)
             arduino_serial.write(chr(speed))
         except KeyboardInterrupt:
             arduino_serial.close()
             sys.exit()
         except KeyError:
             print "System fail to find data."
         except Exception:
             pass
Пример #3
0
 def bicycle_acc(self):
     from connect import SensorDataReceiver, BicycleDataReceiver
     from data import CSVMaker
     import sys
     mysocket = SensorDataReceiver.make_mysocket()
     SensorDataReceiver.bind_mysocket(mysocket)
     data = []
     while True:
         try:
             acc = BicycleDataReceiver.receive_acc_data(mysocket)
             data.append(acc)
         except KeyboardInterrupt:
             CSVMaker().write_bicycle_acc(data)
             sys.exit()
         except Exception:
             pass
Пример #4
0
 def bicycle_senbay_acc_ver(self):
     mysocket = SensorDataReceiver.make_mysocket()
     SensorDataReceiver.bind_mysocket(mysocket)
     arduino_serial = SerialConnector.get_connection()
     pre_acc = 0
     while True:
         try:
             acc = BicycleDataReceiver.receive_acc_data(mysocket)
             val = BicycleDataReceiver.receive_acc_actuation_value(
                 pre_acc, acc)
             arduino_serial.write(chr(val))
             pre_acc = acc
         except KeyboardInterrupt:
             arduino_serial.close()
             sys.exit()
         except KeyError:
             print "System fail to find data."
         except Exception:
             pass