Skip to content

Instantly share code, notes, and snippets.

@dtex
Created October 2, 2018 16:09
Show Gist options
  • Save dtex/222d2645100e81f9c6ca03f5c15e910c to your computer and use it in GitHub Desktop.
Save dtex/222d2645100e81f9c6ca03f5c15e910c to your computer and use it in GitHub Desktop.
board.on("ready", () => {
board.io.accelStepperConfig({
deviceNum: 0,
type: board.STEPPER.TYPE.FOUR_WIRE,
motorPin1: 5,
motorPin2: 6,
motorPin3: 7,
motorPin4: 8,
stepSize: board.STEPPER.STEP_SIZE.WHOLE
});
board.io.accelStepperConfig({
deviceNum: 1,
type: board.STEPPER.TYPE.FOUR_WIRE,
motorPin1: 9,
motorPin2: 10,
motorPin3: 11,
motorPin4: 12,
stepSize: board.STEPPER.STEP_SIZE.HALF
});
board.io.accelStepperSpeed(0, 400);
board.io.accelStepperSpeed(1, 400);
board.io.multiStepperConfig({
groupNum: 0,
devices: [0, 1]
});
board.io.multiStepperTo(0, [2000, 3000], () => {
board.io.accelStepperReportPosition(0, value => {
console.log(`Stepper 0 position: ${value}`);
});
board.io.accelStepperReportPosition(1, value => {
console.log(`Stepper 1 position: ${value}`);
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment