Hi !
It’s C# time! Myo SDK is good one, but let’s be honest C++ is kind of complicated for quick starts; and C# is a much easiest way to do this. After a quick search I’ve found a couple of .Net SDK implementation and MyoSharp deserves a review.
Note: Myo also support a simple script support which is great to perform some basic actions. I’ll write something about this later.
MyoSharp is a .Net 2.0 framework class library, so it’s very easy to include this in our apps. The main page in GitHub has a very nice introduction to the project, so I’ll go directly to a C# Console App.
I’ve downloaded and build the complete source code of MyoSharp for this sample. Then I’ve created a Console App and add this project to the main solution.
Once we have created the project, we need to add a reference to the MyoSharp.dll and copy the platform specific myo*.dll into the same directory as your application. For this sample I’ll work in x86 target.
Now in the main method we must add some code to interact with Myo. The following code displays the creation of the channel and the hub, which are the main components of the myo SDK (lines 12 and 15).
Then we subscribe to the events for pose changed, lock and unlock only when the hub detects a Myo device. In each one of this events, I’ll display some information in the Console app.
And that’s it, we can now launch the app and see how it display our poses in the console app.
In the next post I’ll go deeper into a more advanced sample.
Greetings @ Toronto
El Bruno
References
GitHub MyoSharp
4 comments