Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
83 lines (45 sloc) 1.39 KB

Motion - GP2Y0D810Z0F

Motion - GP2Y0D815Z0F

Motion detection with GP2Y0D815Z0F sensor.


Fritzing diagram: docs/breadboard/GP2Y0D810Z0F.fzz


Run this example from the command line with:

node eg/motion-gp2y0d815z0f.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.Motion({
    controller: "GP2Y0D810Z0F",
    pin: "A0"

  // "calibrated" occurs once, at the beginning of a session,
  motion.on("calibrated", function() {

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

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



Copyright (c) 2012-2014 Rick Waldron Licensed under the MIT license. Copyright (c) 2015-2019 The Johnny-Five Contributors Licensed under the MIT license.

You can’t perform that action at this time.