Permalink
Fetching contributors…
Cannot retrieve contributors at this time
67 lines (31 sloc) 958 Bytes

Servo - Slider control

Breadboard for "Servo - Slider control"

docs/breadboard/servo-slider.png

Fritzing diagram: docs/breadboard/servo-slider.fzz

 

Run this example from the command line with:

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

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

  var slider = new five.Sensor("A0");
  var tilt = new five.Servo(9);

  slider.scale([0, 180]).on("slide", function() {

    // The slider's value will be scaled to match the tilt servo range
    tilt.to(this.value);
  });
});

 

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.