Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MyoJS. From gesture to code - EmberJS DD 2016

MyoJS. From gesture to code - EmberJS DD 2016

The Myo armband measures the electrical activity from your muscles to detect what gesture your hand is making. It also senses all of the motions and rotations of your hand and forearm.

The talk is about the Javascript library which allows to detect gestures and make web applications based on hand motions.

Alex Canessa

August 18, 2016
Tweet

More Decks by Alex Canessa

Other Decks in Programming

Transcript

  1. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 @alexcanessa

    Italian full stack developer co-founder of bisquits working at DigitalDetox
  2. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Electromyography

    (EMG) is an electrodiagnostic technique for evaluating and recording the electrical activity produced by skeletal muscles. EMG
  3. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Gestures

    and motions Double Tap Fist Spread Fingers Wave In Wave Out Rotate Move
  4. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Meet

    the Man With a Myo-Controlled Robotic Arm
  5. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Platforms

    Arduino Virtual Reality Smartphone Web App Computer
  6. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 var

    Myo = require('myo'); Myo.connect(‘com.acanessa.myApp’); Myo.on(‘connected', function() { // this is the myo armband this.vibrate(); });
  7. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Methods

    and Events • Myo.on • Myo.off • Myo.lock • Myo.unlock • Myo.vibrate • Myo.streamEMG • on('pose') • on('orientation') • on('arm_synced') • on('connected') • on('locked') • on('battery_level') https://github.com/thalmiclabs/myo.js/blob/master/docs.md
  8. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Web

    Sockets “WebSockets is an advanced technology that makes it possible to open an interactive communication session between the user's browser and a server. With this API, you can send messages to a server and receive event-driven responses without having to poll the server for a reply.” MDN
  9. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Myo.socket

    = new Socket('ws://127.0.0.1:10138/myo/'); Create the connection
  10. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 What

    does it mean? WebSockets JSON myo.js Myo { } < /> onmessage send() WS
  11. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 What

    does it mean? WebSockets JSON myo.js Myo { } < /> send() onmessage WS
  12. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Listen

    for a web socket event Myo.socket.onmessage = Myo.handleMessage; pose : function(myo, data){ myo.trigger(data.pose); myo.trigger('pose', data.pose); }
  13. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Trigger

    a web socket event vibrate : function(intensity){ intensity = intensity || 'medium'; Myo.socket.send(JSON.stringify(['command',{ "command": "vibrate", "myo": this.connectIndex, "type": intensity }])); return this; }
  14. @alexcanessa MyoJS - EmberJS - Digital Detox - 2016 Grazie

    @alexcanessa [email protected] https://github.com/alexcanessa/myojs-from-gesture-to-code https://speakerdeck.com/alexcanessa