Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: How to tell if TeensyStep controller is still moving, or has reached its setPoint?

  1. #1
    Junior Member
    Join Date
    Dec 2017
    Posts
    4

    How to tell if TeensyStep controller is still moving, or has reached its setPoint?

    I'm using the excellent TeensyStep library to control stepper motors in my project. It's definitely made some things easier.

    There doesn't seem to be any API to access the private 'target' member in the Stepper class, nor any API in the controller to determine if the controller has reached it's target or not (ie: Is it still moving?) This would be handy after calling moveAsync, to poll the controller for the current status of its motors.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    7,765
    Looking at the github readme shows this?:
    The move command is blocking. I.e., it will not return until the movement is finished. If you need to do some work while the motors are rotating you can use the non blocking moveAsync command.
    ...
    controller.moveAsync(motor_1, motor_2); // This will start the movement and return immediately
    doSomeWork();

    while(controller.isRunning()){ // wait until the movement is finished
    delay(10);
    }
    Does that give what is needed?

  3. #3
    Junior Member
    Join Date
    Dec 2017
    Posts
    4
    Yep! Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •