Skip to content

Instantly share code, notes, and snippets.

@prafulfillment
Created March 26, 2014 01:35
Show Gist options
  • Save prafulfillment/9775334 to your computer and use it in GitHub Desktop.
Save prafulfillment/9775334 to your computer and use it in GitHub Desktop.
var five = require("johnny-five"),
board, servo;
board = new five.Board();
board.on("ready", function() {
servos = {
acceleration: new five.Servo({
pin: 9,
range: [0, 180], // Default: 0-180
type: "standard", // Default: "standard". Use "continuous" for continuous rotation servos
startAt: 90, // if you would like the servo to immediately move to a degree
center: false // overrides startAt if true and moves the servo to the center of the range
}),
steering: new five.Servo({
pin: 10,
range: [40, 100],
type: "standard",
startAt: 75,
center: true,
})
};
acceleration = servos.acceleration;
steering = servos.steering;
// Inject the `servo` hardware into
// the Repl instance's context;
// allows direct command line access
board.repl.inject({
s: servos
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment