Skip to content

Latest commit

 

History

History
83 lines (50 loc) · 1.19 KB

button-EVS_EV3.md

File metadata and controls

83 lines (50 loc) · 1.19 KB

Button - EVShield EV3

Run this example from the command line with:

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

board.on("ready", function() {
  var leda = new five.Led(10);
  var ledb = new five.Led(11);

  var BAS1 = new five.Button({
    controller: "EVS_EV3",
    pin: "BAS1"
  });

  var BBS1 = new five.Button({
    controller: "EVS_EV3",
    pin: "BBS1"
  });

  BAS1.on("down", function(value) {
    leda.on();
  });

  BAS1.on("hold", function() {
    leda.blink(500);
  });

  BAS1.on("up", function() {
    leda.stop().off();
  });

  BBS1.on("down", function(value) {
    ledb.on();
  });

  BBS1.on("hold", function() {
    ledb.blink(500);
  });

  BBS1.on("up", function() {
    ledb.stop().off();
  });
});
<iframe width="560" height="315" src="https://www.youtube.com/embed/mAwvQJQo09Y" frameborder="0" allowfullscreen></iframe>

 

License

Copyright (c) 2012-2014 Rick Waldron [email protected] Licensed under the MIT license. Copyright (c) 2015-2023 The Johnny-Five Contributors Licensed under the MIT license.