Permalink
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (35 sloc) 1.03 KB

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-2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2015-2018 The Johnny-Five Contributors Licensed under the MIT license.