Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
 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)
Ejemplo n.º 3
0
 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)
Ejemplo n.º 4
0
 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)
Ejemplo n.º 5
0
 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))
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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")
Ejemplo n.º 8
0
 def on_unsync(self, myo, timestamp):
     myo.set_stream_emg(stream_emg.enabled)
     print_('unsynced')
Ejemplo n.º 9
0
 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")