Created
March 26, 2014 01:35
-
-
Save prafulfillment/9775334 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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