2014-12-14 08:19:25 +08:00
|
|
|
"use strict";
|
|
|
|
|
|
|
|
var Cylon = require("../..");
|
2014-02-04 05:40:50 +08:00
|
|
|
|
|
|
|
Cylon.robot({
|
2014-11-11 04:37:33 +08:00
|
|
|
connections: {
|
2014-12-14 08:19:25 +08:00
|
|
|
leap: { adaptor: "leapmotion" },
|
|
|
|
arduino: { adaptor: "firmata", port: "/dev/ttyACM0" }
|
2014-11-11 04:37:33 +08:00
|
|
|
},
|
2014-02-04 05:40:50 +08:00
|
|
|
|
2014-11-26 08:01:31 +08:00
|
|
|
devices: {
|
2014-12-14 08:19:25 +08:00
|
|
|
led: { driver: "led", pin: 13, connection: "arduino" }
|
2014-11-26 08:01:31 +08:00
|
|
|
},
|
2014-02-04 05:40:50 +08:00
|
|
|
|
|
|
|
work: function(my) {
|
2014-12-14 08:19:25 +08:00
|
|
|
my.leapmotion.on("frame", function(frame) {
|
2014-11-26 06:39:24 +08:00
|
|
|
if (frame.hands.length > 0) {
|
|
|
|
my.led.turnOn();
|
2014-02-04 05:40:50 +08:00
|
|
|
} else {
|
|
|
|
my.led.turnOff();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}).start();
|