LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Limit switches with stepper motor

Hi iam trying to implement a limitswitch to stop my stepper motor when it hits the edge of the wall. I first set the stepper motor to run a certain number of steps but when i read a high voltage of the limit switch it does not stop from the number of steps already taken. Iam not sure how to tell the stepper motor to stop as soon as the limit switch is triggered. My sample vi home works but it forces me to put the stepper motor function in a while loop.

0 Kudos
Message 1 of 3
(5,602 Views)

I didn't write the stepper portion of the toolkit, but I don't think this functionality is built into the Arduino Stepper API.

I think the way the stepper library works is that you tell it a number of steps and forget about it.  There is no built in way to cancel the current action.

The LIFA Stepper support is built on the AccelStepper library, so I'd start there to se if there is a way to stop the current action.

-Sam K

0 Kudos
Message 2 of 3
(3,927 Views)

Sam is correct.

This functionality is not built into the toolkit but is exposed in the AccelStepper library so you will have to expose some extra functionality from the library to get that behavior.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 3 of 3
(3,927 Views)