Plex is awesome. It’s an important part of our media centre at home. When I started playing with Myo apps, I figured Plex should be my first stop. I set to develop a small desktop app that would allow me to navigate in Plex and play/pause movies from my couch.
Developing small Myo desktop apps is easy: Thalmic wrote a few tutorials to cover the basics, and that also helps you grasp the basics of Lua.
My goals with this small app were simple:
- I wanted to learn as much as possible about Myo and Lua
- It should only be triggered in the Plex app
- I wanted to use the 5 basic Myo gestures
- I wanted to implement one of the combo gestures to understand how to monitor the position of the band on the arm.
The first 3 steps turned out to be easy: I had it working in less than an hour. This was mostly thanks to Myo API reference where I learned about the different functions I could use in the app, and the tutorials posted on Thalmic’s blog, they were very helpful.
The last step, however, took some time.
“Wave in” and “Wave out” are 2 of the basic Myo gestures. They’re often mapped with “Previous” and “Next” actions in Myo apps. That’s useful in Plex, but I also needed 2 more actions: Up and Down, to navigate the different Plex menus.
I figured I would use the same 2 basic gestures for all 4 actions, but change the output based on the rotation of the arm. If you think about it, if you rotate your arm 90 degrees and wave in or out, it’s really like you’d be waving up or down.
Detecting the arm rotation was the most difficult. 3 things were helpful there:
myo.getRoll()(#) detects the position of the band on your arm
onUnlock()(#) allows you to attach actions right when the band becomes unlocked. I used that to reset the roll value, since your arm should be resting when you unlock the band.
onPeriodic()(#) can be used to query the band every 10 milliseconds to check its position.
Here is the code I came up with. You can download it and install it on your computer through Myo’s application manager. Feel free to submit Pull Requests if you have ideas to improve the app.
4 replies on “Myo: Control Plex without leaving your couch”
Thanks for working on this connector! I couldn’t get it to be recognized in the application manager until deleting “return true” before “end” in the app detection segment. I then couldn’t get the Myo to recognize the difference between left/right and up/down behavior either–it only gave up/down inputs, regardless of the rotation of my hand. I know this is the puzzle, sorry for not having any solution for a better answer. But I thought the feedback might be helpful. Thanks again.
That’s useful, thank you! Do you use Plex on a Mac or a Windows machine?
Thanks! I had indeed forgotten to remove that line after my tests.
I built the app to reset your arm position as soon as you unlock the Myo. So you’ll have to move your arm after unlocking to switch between Up/Down and Left/Right.
Let me know how that goes.