forked from stolksdorf/myo.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
77 lines (56 loc) · 1.37 KB
/
demo.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<html>
<head>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js'></script>
<script src='./myo.js'></script>
<script src='./experimental/myo.experimental.js'></script>
</head>
<body>
<div id='log'>
</div>
</body>
<style>
#log{
height : 50px;
width : 50px;
background-color: red;
}
</style>
<script>
var log = document.getElementById('log')
var myo = Myo.create(0);
myo.on('pose', function(poseName){
//console.log(poseName);
})
myo.on('arm_recognized', function(){
console.log('good!', this.id);
})
myo.on('arm_lost', function(){
console.log('bad', this.id);
})
myo.on('wave_left', function(){
console.log('wave Left!');
})
myo.on('fist', function(){
console.log('BT PLZ');
myo.requestBluetoothStrength();
})
myo.on('connected', function(){
setInterval(function(){
myo.requestBluetoothStrength();
}, 100);
})
myo.on('bluetooth_strength', function(BTS){
var width = ((BTS * -1 - 40 ) / 50 ) * 100 + '%';
$('#log').width(width);
console.log(width);
})
myo.on('double_tap', function(){
this.zeroOrientation();
console.log('double tap') ;
});
myo.on('gyroscope', function(data){
if(data.y < -2) console.log('hit!');
});
</script>
</html>