johnny-five-electron
Version:
Temporary fork to support Electron (to be deprecated)
41 lines (35 loc) • 1.27 kB
JavaScript
var five = require("../lib/johnny-five");
var Edison = require("edison-io");
var board = new five.Board({
io: new Edison()
});
board.on("ready", function() {
// Plug the PIR Motion Sensor into D4
var motion = new five.Motion(4);
// "calibrated" occurs once, at the beginning of a session,
motion.on("calibrated", function() {
console.log("calibrated");
});
// "motionstart" events are fired when the "calibrated"
// proximal area is disrupted, generally by some form of movement
motion.on("motionstart", function() {
console.log("motionstart");
});
// "motionend" events are fired following a "motionstart" event
// when no movement has occurred in X ms
motion.on("motionend", function() {
console.log("motionend");
});
});
// @markdown
// For this program, you'll need:
//
// 
//
// 
//
// 
//
// - [Grove - PIR Motion Sensor](http://www.seeedstudio.com/depot/Grove-PIR-Motion-Sensor-p-802.html)
//
// @markdown