Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
94 lines (54 sloc) 1.47 KB

Button - Options

Breadboard for "Button - Options"


Fritzing diagram: docs/breadboard/button-options.fzz


Run this example from the command line with:

node eg/button-options.js
var five = require("johnny-five"),
  board, button;

board = new five.Board();

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

  // Create a new `button` hardware instance
  button = new five.Button({
    board: board,
    pin: 8,
    holdtime: 1000,
    invert: false // Default: "false".  Set to "true" if button is Active-Low

  // Inject the `button` hardware into
  // the Repl instance's context;
  // allows direct command line access
    button: button

  // Button Event API

  // "down" the button is pressed
  button.on("down", function() {

  // "hold" the button is pressed for specified time.
  //        defaults to 500ms (1/2 second)
  //        set
  button.on("hold", function() {

  // "up" the button is released
  button.on("up", 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.