Skip to content

Latest commit

 

History

History
77 lines (41 loc) · 1.31 KB

ir-motion.md

File metadata and controls

77 lines (41 loc) · 1.31 KB

IR Motion

Breadboard for "IR Motion"

docs/breadboard/ir-motion.png

Fritzing diagram: docs/breadboard/ir-motion.fzz

 

Run this example from the command line with:

node eg/ir-motion.js
var five = require("johnny-five");
var board = new five.Board();

board.on("ready", function() {

  // Create a new `motion` hardware instance.
  var motion = new five.IR.Motion(7);

  // "calibrated" occurs once, at the beginning of a session,
  motion.on("calibrated", function() {
    console.log("calibrated", Date.now());
  });

  // "motionstart" events are fired when the "calibrated"
  // proximal area is disrupted, generally by some form of movement
  motion.on("motionstart", function() {
    console.log("motionstart", Date.now());
  });

  // "motionend" events are fired following a "motionstart" event
  // when no movement has occurred in X ms
  motion.on("motionend", function() {
    console.log("motionend", Date.now());
  });
});

 

License

Copyright (c) 2012-2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2015-2023 The Johnny-Five Contributors Licensed under the MIT license.