#Myo – Starting as a developer with some C++ basic code

Hi !

Let’s get a little deeper into the Myo armband. Myo read electrical signs from your arm and it can detect up to 5 distinct poses: wave left, wave right, spread fingers, fist, and pinch. It also has a couple of motion sensors, so with all this information you can start to think into possibilities.

image

The armband collect and share all this information via Bluetooth, so nowadays we can use the Myo armband connected to almost, any device. Out of the box there are samples to control VLC, Spotify, or even drones or the Sphero toys. And, of course, because this is gesture based, you have a PowerPoint controller !

In order to start to use all these features as a Developer, we need to enable the Developer Mode. In the Myo preferences app, go to the General section and we need to enable the 5th option.

image

Now we can access the debug console which is something we can use later in our development process.

imageT

So, now is time to download the SDK. Until today Myo have released SDKs for

  • Windows
  • Mac
  • iOS
  • Android

The SDK details are a 10 minutes read (here). On Windows, MYO provides a single DLL for both architectures, named myo32.dll and myo64.dll

image

The core of the SDK is a library: libmyo. This library allows applications to interact with the Myo armband. All functionality in libmyo is exposed through a plain C API.

image

The SDK provides data to the application in the form of events. There are three categories of events: spatial events(corresponding to spatial data from a Myo armband), gestural events (corresponding to gestural data a Myo armband) and auxiliary events.

There is plenty of information about the internals of the SDK, but let’s go to see some code. In the SDK folder we can find the C++ header and hpp files to be used in a sample C++ app. So let’s go for this.

image

In a console app, we need to inherit from DeviceListener to have access to the Myo armband features.

image

Using the Myo hub, we can access to the EMG information, the orientation / position information and also the poses information. In example, once a pose is detected we can notify the user about this pose or take additional actions.

image

A nice starting point are the 3 C++ sample projects included in the SDK. However I know that not so many people are used to C++ so in my next post I’ll switch to C# thanks to one of the many Myo.Net implementations available.

 

Greetings @ Toronto

El Bruno

References

Advertisements

4 thoughts on “#Myo – Starting as a developer with some C++ basic code

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s