Esempio n. 1
0
def main():
    print('Start Myo for Linux')
    param = 0
    if len(sys.argv) > 1:
        param = sys.argv[1]
	
	listener = PrintPoseListener()
    if param == 1:
        listener = EmgListener()
	    
    myo = Myo()

    try:
        myo.connect()
        myo.add_listener(listener)
        myo.vibrate(VibrationType.SHORT)
        while True:
            x = myo.run()
            if x != [] or None:
                print(x)
				

    except KeyboardInterrupt:
        pass
    except ValueError as ex:
        print(ex)
    finally:
        myo.safely_disconnect()
        print('Finished.')
def main():
    print('Start Myo for Linux')

    listener = PrintPoseListener()
    myo = Myo()
    try:
        myo.connect()
        myo.add_listener(listener)
        myo.vibrate(VibrationType.SHORT)
        while True:
            myo.run()

    except KeyboardInterrupt:
        pass
    except ValueError as ex:
        print(ex)
    finally:
        myo.safely_disconnect()
        print('Finished.')
import sys
sys.path.append('../lib/')

from myo import Myo
from print_pose_listener import PrintPoseListener
from vibration_type import VibrationType

print("Start of myo_interface_module")
myo = Myo()
listener = PrintPoseListener()


def connect_myo(control_values):
    try:
        myo.connect()
        listener.set_control_values(control_values)
        myo.add_listener(listener)
        myo.vibrate(VibrationType.SHORT)
    except Exception as ex:
        print(ex)


def detect_myo_pose():
    myo.run()


def deinit_myo():
    myo.safely_disconnect()
    print("Finished")