rwaldron/johnny-five

How to stop stepper motor programmatically?

berzins92 opened this issue · 2 comments

Hi there!
I have problems stoping stepper driver programmatically in case it triggers end-stop switch.

I can't find API reference to this. Anyone has any idea how to do this?

I am using: five.Stepper.TYPE.DRIVER

dtex commented

@berzins92 Johnny-Five supports the first version of stepper built into firmata. That version does not allow for stopping a stepper programmatically.

There is a newer version of stepper called AccelStepperFirmata that does support stopping programmatically. You can get a custom build of firmata over at http://firmatabuilder.com/ that includes the newer version, and you can see how it's used by firmata.js in this example.

The firmata.js documentation for AccelStepper is pretty clear, and the API is much more "Johnny-Five" like than other firmata features. You can talk directly to firmata in a Johnny-Five program by accessing the 'board.io' property (assuming you called it board).

Thanks @dtex.
baord.io.accelStepperStop(1)

where 1 is stepper id.