Guest User

Untitled

a guest
Jul 2nd, 2018
144
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. from mbientlab.metawear import *
  2. from mbientlab.metawear.cbindings import *
  3. import sys
  4.  
  5.  
  6. address = sys.argv[1]
  7. device = MetaWear(address)
  8. device.connect()
  9. board = device.board
  10. print("connected to %s" % address)
  11.  
  12.  
  13. euler_signal = libmetawear.mbl_mw_sensor_fusion_get_data_signal(board, SensorFusionData.EULER_ANGLE)
  14. euler_callback = FnVoid_VoidP_DataP(lambda context, data: print("euler %s" % parse_value(data)))
  15. libmetawear.mbl_mw_datasignal_subscribe(euler_signal, None, euler_callback)
  16. libmetawear.mbl_mw_sensor_fusion_enable_data(board, SensorFusionData.EULER_ANGLE)
  17. print("activated euler")
  18.  
  19.  
  20. libmetawear.mbl_mw_sensor_fusion_set_mode(board, SensorFusionMode.NDOF)
  21. libmetawear.mbl_mw_sensor_fusion_write_config(board)
  22. libmetawear.mbl_mw_sensor_fusion_start(board)
  23. print("started")
  24.  
  25.  
  26. input("")
  27.  
  28.  
  29. libmetawear.mbl_mw_sensor_fusion_stop(board)
  30. libmetawear.mbl_mw_sensor_fusion_clear_enabled_mask(board)
  31. libmetawear.mbl_mw_datasignal_unsubscribe(euler_signal)
  32. print("deactivated sensors")
  33.  
  34.  
  35. device.disconnect()
  36. sleep(1)
  37. print("disconnected")
RAW Paste Data