-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathblink2.js
More file actions
32 lines (26 loc) · 780 Bytes
/
blink2.js
File metadata and controls
32 lines (26 loc) · 780 Bytes
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
"use strict";
var Cylon = require("cylon");
Cylon.robot({
connections: {
leapmotion: { adaptor: "leapmotion" },
arduino: { adaptor: "firmata", port: "/dev/cu.usbmodem1411" } // /dev/cu.usbmodem1411 /dev/cu.usbmodem1451
},
devices: {
led: { driver: "led", pin: 13, connection: "arduino" },
led9: { driver: "led", pin: 9, connection: "arduino" },
leapmotion: { driver: 'leapmotion' }
},
work: function(my) {
my.leapmotion.on('frame', function(frame) {
if (frame.hands.length > 0) {
console.log("LED ON")
my.led.turnOn();
my.led9.turnOn();
} else {
console.log("LED OFF");
my.led.turnOff();
my.led9.turnOff();
}
});
}
}).start();