Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stepper: Runstate / Position tracking #1407

Closed
Triadager opened this issue Oct 26, 2017 · 2 comments
Closed

Stepper: Runstate / Position tracking #1407

Triadager opened this issue Oct 26, 2017 · 2 comments

Comments

@Triadager
Copy link

Hey guys!

Sorry to be a pain but googling and experimenting for hours didn't get me anywhere.

I'm trying to control some steppers with an Arduino which gets its commands via Firmata. I want to implement some check whether to stepper is already moving if I issue another command. I figured this would be done with checking out the steppers "Runstate", but I couldn't get it to work at all. Did I misunderstand to what the "Runstate"-table on the stepper API page is referring to? If not, how can I access it? Could you maybe provide some example code on how to use these "Runstates"?

Another question regarding steppers: If I issue a different command while the stepper is moving, it'll interrupt the motion and the new command will be executed. Is there any possibility to track how many steps it already took? I'm using stepper driver boards like the A4988, so I'm thinking about just using another pin to monitor the pulses to the step pin, but I'm not sure if that's the most elegant solution. Any ideas?

Kind regards,

Triadager

@dtex
Copy link
Collaborator

dtex commented Oct 26, 2017

Hi @Triadager

I will try and help. I believe those runstate values were inserted for future functionality that was never implemented. They don't appear to do anything. I could be just looking in the wrong place, but I don't think that's the case here. There is an isRunning state but it is private. You could create your own isRunning variable that is set to true whenever you call step, and set to false in a step callback.

Is there any possibility to track how many steps it already took?

Not yet. There is a new version of configurableFirmata that adds a new AccelStepperFirmata feature that when coupled with this pull request for firmata.js will let you know actual position reached, even when the stepper is interrupted by another command. I expect that PR to land soon. It is just waiting to be blessed by @rwaldron.

The new version of the Johnny-Five stepper class that supports AccelStepperFirmata is in progress but likely won't be ready for weeks, but you can totally use the firmata.js stepper stuff directly on the board.io object. It's much higher level than the other firmata methods so it feels very J5'ish when using it.

@dtex
Copy link
Collaborator

dtex commented Oct 29, 2017

I'm going to close this. If you have more questions, feel free to reopen, or open a new issue on the applicable repo.

@dtex dtex closed this as completed Oct 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants