/// <summary> /// Initialize the Myo input module. Will throw an exception if no Myo is available /// </summary> public MyoInput() { Active = true; hub = new Hub("de.dhbw.MyoPilot"); myo = hub.WaitForMyo(TimeSpan.FromSeconds(5)); if (myo == null) { throw new TimeoutException("Unable to find a Myo!"); } hub.MyoUnpaired += OnUnpair; myo.PoseChanged += OnPoseChanged; myo.OrientationDataAcquired += OnOrientationData; myo.RecognizedArm += OnRecognizedArm; myo.LostArm += OnLostArm; myo.Unlock(UnlockType.Hold); // hub.Run() needs to run permanently in order to receive events from the Myo Thread worker = new Thread(hub.Run) { IsBackground = true, Name = "MyoBackgroundWorker" }; worker.Start(); }
/// <summary> /// Initialize the Myo input module. Will throw an exception if no Myo is available /// </summary> public MyoInput() { hub = new Hub("de.dhbw.MyoPilot"); myo = hub.WaitForMyo(TimeSpan.FromSeconds(5)); if (myo == null) throw new TimeoutException("Unable to find a Myo!"); hub.MyoUnpaired += OnUnpair; myo.PoseChanged += OnPoseChanged; myo.OrientationDataAcquired += OnOrientationData; myo.RecognizedArm += OnRecognizedArm; myo.LostArm += OnLostArm; myo.Unlock(UnlockType.Hold); // hub.Run() needs to run permanently in order to receive events from the Myo Thread worker = new Thread(hub.Run) { IsBackground = true, Name = "MyoBackgroundWorker" }; worker.Start(); }