rwaldron/johnny-five

Stop stepper while running

Torsten85 opened this issue · 2 comments

Hello,

is it possible to stop a stepper while its running? I need an "emergency stop" function, but I don't see a way to cancel the ongoing steps.

Also one additional stepper related question (I don't want to make another issue for that):
Could someone briefly explain the parameters for accel / decel to me? The docs show this:

//   - Accelerate over the first 1600 steps
//   - Decelerate over the last 1600 steps

stepper.step({ steps: 2000, direction: 1, accel: 1600, decel: 1600 }, function() { console.log("Done stepping!") })

which does not make much sense to me. To fully accelerate / decelarate, there should be at least 3200 steps right? Makes a higher number a faster acceleration?

Thanks in advance.

dtex commented

Johnny-Five's stepper class targeted firmata's legacy stepper protocol (which was just "stepper" back then) and legacy stepper does not support stop.

Since then, accelStepper has been added to firmata, and it does support stop (along with many other things). Unfortunately, it has not made the leap to Johnny-Five. It is possible to use Accel Stepper directly on the board object (assuming you are using firmata) if you still want to use Johnny-Five for other things.

AccelStepperFirmata documentation
Example program

@dtex Thanks that helps a lot! Didn't even know there was a firmata.js! I'll close this issue then.