Skip to content

Latest commit

 

History

History
98 lines (59 loc) · 1.22 KB

micromagician-servo.md

File metadata and controls

98 lines (59 loc) · 1.22 KB

Micro Magician V2 - Servo

Run this example from the command line with:

node eg/micromagician-servo.js
var five = require("johnny-five");

var board = new five.Board({
  debug: true
});

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

  var servo = new five.Servo("A3");

  // Add servo to REPL (optional)
  this.repl.inject({
    servo: servo
  });

  // Servo API

  // min()
  //
  // set the servo to the minimum degrees
  // defaults to 0
  //
  // eg. servo.min();

  // max()
  //
  // set the servo to the maximum degrees
  // defaults to 180
  //
  // eg. servo.max();

  // center()
  //
  // centers the servo to 90°
  //
  // servo.center();

  // to( deg )
  //
  // Moves the servo to position by degrees
  //
  // servo.to( 90 );

  // step( deg )
  //
  // step all servos by deg
  //
  // eg. array.step( -20 );

  servo.sweep();

});

Learn More

 

License

Copyright (c) 2012-2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2015-2023 The Johnny-Five Contributors Licensed under the MIT license.