-
Notifications
You must be signed in to change notification settings - Fork 2
/
sonarFinder.js
68 lines (51 loc) · 1.3 KB
/
sonarFinder.js
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
var frameCount = 0; // Tracks number of frames leap receives
var Cylon = require('cylon');
Cylon.robot({
name: 'sonarBot',
connections: {
arduino: { adaptor: 'firmata', port: '/dev/cu.usbmodem1411' } // /dev/cu.usbmodem1411 /dev/cu.usbmodem1451
},
devices: {
maxbotix: { driver: 'maxbotix', pin: 1 }
},
work: function(my) {
leap.on('frame', function(frame) {
if (frame.hands.length > 0) {
my.maxbotix.range(function(err, data) {
console.log(err || "range: " + data);
});
}
frameCount++;
if(frameCount % 20 != 0) return;
});
}
}).start();
Cylon.robot({
name: 'leapmotionRobot',
connections: {
leapmotion: { adaptor: "leapmotion" }
},
devices: {
leapmotion: { driver: "leapmotion" }
},
work: function(my) {
}
}).start();
leap = Cylon.MCP.robots.leapmotionRobot.devices.leapmotion;
/*"use strict";
var Cylon = require("cylon");
Cylon.robot({
connections: {
arduino: { adaptor: "firmata", port: "/dev/cu.usbmodem1411" }
},
devices: {
maxbotix: { driver: "maxbotix", pin: 1 }
},
work: function(my) {
every((1).seconds(), function() {
my.maxbotix.range(function(err, data) {
console.log(err || "range: " + data);
});
});
}
}).start();*/