def on_connect(self, myo, timestamp): print_("Connected to Myo") myo.vibrate('short') myo.set_stream_emg(stream_emg.enabled) myo.request_rssi() global start start = time.time()
def init(self, callback): myo.init() self.hub = myo.Hub() self.hub.set_locking_policy(myo.locking_policy.none) self.myo = self.MyoListener(self) self.myo.callback = callback myo.set_stream_emg(stream_emg.enabled) self.hub.run(1000, self.myo)
def on_pose(self, myo, timestamp, pose): print_('on_pose', pose) if pose == pose_t.double_tap: print_("Enabling EMG") print_("Spreading fingers disables EMG.") print_("=" * 80) myo.set_stream_emg(stream_emg.enabled) elif pose == pose_t.fingers_spread: print_("=" * 80) print_("Disabling EMG") myo.set_stream_emg(stream_emg.disabled)
def on_pose(self, myo, timestamp, pose): print_('on_pose', pose) if pose == pose_t.double_tap: print_("Enabling EMG") print_("Spreading fingers disables EMG.") print_("=" * 80) myo.set_stream_emg(stream_emg.enabled) elif pose == pose_t.fingers_spread: print_("=" * 80) print_("Disabling EMG") myo.set_stream_emg(stream_emg.disabled) text = open("pose.txt", "a") text.write("\n{}".format(pose))
def on_pose(self, myo, timestamp, pose): if pose == pose_t.wave_in: #print_('on_pose', pose) print_("You chose Scissors!") opponentChoice(1,myo) myo.set_stream_emg(stream_emg.disabled) elif pose == pose_t.fingers_spread: #print_('on_pose', pose) print_("You chose Paper!") opponentChoice(2,myo) myo.set_stream_emg(stream_emg.disabled) elif pose == pose_t.fist: #print_('on_pose', pose) print_("You chose Rock!") opponentChoice(3,myo) myo.set_stream_emg(stream_emg.disabled)
def on_connect(self, myo, timestamp): print_("Connected to Myo") myo.vibrate('short') myo.request_rssi() myo.set_stream_emg(stream_emg.enabled) print_("Enabling EMG")
def on_unsync(self, myo, timestamp): myo.set_stream_emg(stream_emg.enabled) print_('unsynced')