I'm trying to control atleast 2 stepper motors with the raspberry, which works fine with the following setup:
- Raspberrypi Model 2
- MotorHAT from Adafruit https://www.adafruit.com/products/2348
- Python scripts
So at this moment I am forced to use the Python scripts, because the MotorHAT has only a Python library. Now I've found a Javascript library for stepper motors, which is actually for arduino boards, but still has raspberry support. The library is called Johnny-Five http://johnny-five.io/examples/stepper-driver/ I tried to set the library up and got now the following javascript:
var raspi = require('raspi-io');
var five = require('johnny-five');
var board = new five.Board({
io: new raspi()
});
board.on("ready", function() {
var stepper = new five.Stepper({
type: five.Stepper.TYPE.DRIVER,
stepsPerRev: 200,
pins: {
step: 11,
dir: 13
}
});
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");
});
});
});
This script prints the following error:
Error: Stepper is not supported
at new Stepper ...
at Board ...
at Board.emit (events.js:92.17)
at process._tickCallback (node.js:448:13)
If anyone could figure out my fault or knows a better solution to control the stepper motors from a website, that would be great!