The Python myo
package is a ctypes based wrapper for the Myo shared libraries.
Its goal is to give a complete exposure of the Myo SDK as a high level API to Python developers.
Python Myo is compatible with Python 2 and 3!
# Copyright (C) 2014 Niklas Rosenstein
# All rights reserved.
import myo
myo.init()
from myo.six import print_
class Listener(myo.DeviceListener):
def on_pair(self, myo, timestamp):
print_("Hello Myo")
def on_rssi(self, myo, timestamp, rssi):
print_("RSSI:", rssi)
return False # Stop the Hub
def main():
hub = myo.Hub()
hub.set_locking_policy(myo.locking_policy.none)
hub.run(1000, Listener())
if __name__ == '__main__':
main()
See hello_myo.py for more examples.
- Add this folder (the folder containing README.md and myo/) to your
PYTHONPATH
.
- command line:
export PYTHONPATH=$PYTHONPATH:/path/to/myo-python
; or - programmatically in your Python module:
import os, sys
sys.path.append(os.path.join('path', 'to', 'myo-python'))
- Download the Myo SDK for your system from here.
- Add the full absolute path to the Myo SDK to your
PATH
.
- Windows: The folder containing myo32.dll and myo64.dll (for example C:\Program Files\Thalmic Labs\myo-sdk-win-0.8.0\bin).
- Mac: The sdk/myo.framework/ folder. Comment on #10 if you have issues. Try Editing line 105 in lowlevel.py
- Linux: Use Unity? Comment on #11 if you figure this out and we'll update the README. People have definitely gotten the Myo SDK to work on Linux and there should be some forum posts about it somewhere.
Copyright (C) 2014 Niklas Rosenstein, All rights reserved.