cylon/examples/leap_arduino/leap_arduino.js

25 lines
461 B
JavaScript
Raw Normal View History

2014-12-14 08:19:25 +08:00
"use strict";
var Cylon = require("../..");
Cylon.robot({
connections: {
2014-12-14 08:19:25 +08:00
leap: { adaptor: "leapmotion" },
arduino: { adaptor: "firmata", port: "/dev/ttyACM0" }
},
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
},
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();
} else {
my.led.turnOff();
}
});
}
}).start();