Project: https://www.pyblog.xyz/myo-electric-prosthetic-arm
Run the following commands to initialise the project directory
python3 setup.py build
python3 setup.py install
a. Make sure the moduleId and moduleSecret are defined correcty in your program.
moduleID = "moduleName" # Name can be anything
moduleSecret = "qwerty"
b. Connect to the KaiSDK Websocket.
module = WebSocketModule()
success = module.connect(moduleID, moduleSecret)
module.setCapabilities(module.DefaultKai, KaiCapabilities.AccelerometerData | KaiCapabilities.GyroscopeData | KaiCapabilities.PYRData)
def accelerometerEv(ev):
print(ev.accelerometer.x)
print(ev.accelerometer.y)
print(ev.accelerometer.z)
module.DefaultKai.register_event_listener(Events.AccelerometerEvent, accelerometerEv)
module.unsetCapabilities(module.DefaultKai, KaiCapabilities.AccelerometerData | KaiCapabilities.GyroscopeData | KaiCapabilities.PYRData)
module.close()
Run the example file using the following command
python3 gesture.py