Stepper - Driver
Breadboard for "Stepper - Driver"
Fritzing diagram: docs/breadboard/stepper-driver.fzz
Run this example from the command line with:
node eg/stepper-driver.js
var five = require("johnny-five");
var board = new five.Board();
board.on("ready", function() {
/**
* In order to use the Stepper class, your board must be flashed with
* either of the following:
*
* - AdvancedFirmata https://github.com/soundanalogous/AdvancedFirmata
* - ConfigurableFirmata https://github.com/firmata/arduino/releases/tag/v2.6.2
*
*/
var stepper = new five.Stepper({
type: five.Stepper.TYPE.DRIVER,
stepsPerRev: 200,
pins: {
step: 11,
dir: 13
}
});
// Make 10 full revolutions counter-clockwise at 180 rpm with acceleration and deceleration
stepper.rpm(180).ccw().accel(1600).decel(1600).step(2000, function() {
console.log("Done moving CCW");
// once first movement is done, make 10 revolutions clockwise at previously
// defined speed, accel, and decel by passing an object into stepper.step
stepper.step({
steps: 2000,
direction: five.Stepper.DIRECTION.CW
}, function() {
console.log("Done moving CW");
});
});
});
Additional Notes
License
Copyright (c) 2012, 2013, 2014 Rick Waldron waldron.rick@gmail.com Licensed under the MIT license. Copyright (c) 2016 The Johnny-Five Contributors Licensed under the MIT license.