1

I'm working with Myo. It's an armband which connects to the computer via Bluetooth. It can detect movement of hand and can detect several gestures, such as 'wave_left' , 'wave_right' , 'fingers_spread', 'fist' mainly. Now I've to write the Javascript so that disabled persons can navigate the website using Myo. To implement this, I want to map some key press events with Myo gestures.

wave_left => Tab

wave_right => Shift + Tab

fingers_spread => Backspace

fist => Enter

Now here's the code:

<script src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js'></script>
<script src="https://cdn.rawgit.com/stolksdorf/myo.js/master/myo.js" ></script>
<script src="https://cdn.rawgit.com/stolksdorf/myo.js/master/experimental/myo.experimental.js" ></script>

Myo events are handled here like following:

var myo = Myo.create(0);

myo.on('arm_recognized', function(){
    console.log('arm found!', this.id);
});
myo.on('arm_lost', function(){
    console.log('arm lost', this.id);
});
myo.on('wave_left', function(){
    console.log('wave Left!');
    // Tab Key Press Event to be Triggered
});
myo.on('wave_right', function(){
    console.log('wave Right!');
    // Shift + Tab key Press Event to be Triggered 
});
myo.on('fingers_spread', function(){
    console.log('spread!');
    // BackSpace key press to be triggered
});
myo.on('fist', function(){
    console.log('fist');
    // Enter key press to be triggered 
});
myo.on('connected', function(){

});
myo.on('bluetooth_strength', function(BTS){
    console.log(width);
});
myo.on('double_tap', function(){
    console.log('double tap') ;
});
myo.on('gyroscope', function(data){

});

I've searched internet. For simulating Tab key press, people suggested to use $('some_element').next().focus() , but I want to get the native Tab key press. This post says it's not possible because of security issue. But the post is from 2009, and html5 has progressed a lot after then. Is it possible now to trigger keypress event of the special keys and get native result? If possible, what should I do?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Rafaf Tahsin
  • 7,652
  • 4
  • 28
  • 45

0 Answers0