Switch - Magnetic Door

Breadboard for "Switch - Magnetic Door"

docs/breadboard/switch-magnetic-door.png

Fritzing diagram: docs/breadboard/switch-magnetic-door.fzz

 

Run this example from the command line with:

node eg/switch-magnetic-door.js
var five = require("johnny-five");
var board = new five.Board();

board.on("ready", function() {
  // Contact Mode: Normally Open (default!)
  var sw = new five.Switch(7);

  sw.on("open", function() {
    console.log("open");
  });

  sw.on("close", function() {
    console.log("close");
  });
});

Learn More

 

License

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