I bought a 1067B stepper motor controller. Seems to work well and is easy to control. I am controlling the phidget using a C-program on MacOS (though eventually I will switch to C-program on linux).
I would like to be able to stop this motor controller based on a limit switch. I understand that the phidget doesn't have a direct digital inputs for stopping the motor (I read your other post explaining why, though I am still surprised to find a motor controller without digital inputs for limits). I bought a 1012_2B and some limit switches to detect when the linear stage gets to the end.
However, I am confused about what to do once I detect that a limit switch has been activated. The 1067 API that I find here
https://www.phidgets.com/?tier=3&catid= ... &prodid=66
doesn't seem to list a 'stop movement' function that I could call when I find a limit switch has been reached.
I suppose I could call PhidgetStepper_setEngaged(ch,0); but it seems that would also remove the hold current from the motor and would make the stage likely to rebound off the limit switch and end up in a poorly defined position. That doesn't seem like a good option.
I could also do something like
PhidgetStepper_getPosition(ch, &position)
PhidgetStepper_setTargetPosition(ch,position)
to read the current position and then set the target position to that position. I think this would work, though it seems pretty awkward.
Is there a simpler way of stopping the motor that I don't see?
______________________
Incidentally, the webpage API listed for the 1067B seems to be wrong. The webpage lists the API for some current sensing device:
https://www.phidgets.com/?tier=3&catid= ... rodid=1029