Skip to content

Latest commit

 

History

History
76 lines (47 loc) · 1.02 KB

tinkerkit-combo.md

File metadata and controls

76 lines (47 loc) · 1.02 KB

TinkerKit - Combo

Run this example from the command line with:

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

board.on("ready", function() {
  var accel = new five.Accelerometer({
    id: "accelerometer",
    pins: ["I0", "I1"]
  });

  var slider = new five.Sensor({
    id: "slider",
    pin: "I2"
  });

  var servos = new five.Servos([
    {
      id: "servo",
      pin: "O0",
      type: "continuous"
    },
    {
      id: "servo",
      pin: "O0",
      type: "continuous"
    }
  ]);

  slider.scale(0, 180).on("change", function() {
    servos.to(this.value);
  });

  accel.on("acceleration", function() {
    // console.log( this.raw.x, this.raw.y );
  });
});

 

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.