Automatic limit switch

I previously found out how to program a limit switch that i can manually use. Now my question is how do i program a limit switch that will cause my motor to automatically stop spinning when it reaches a certain speed or position?

To stop a motor at a certain speed, that is a job for encoders. Encoders track the number of rotations of a shaft which you can use to compute the speed.

You could use a limit switch to stop a motor when the motor reaches a certain position, assuming that the motor turns some armature which physically turns the switch off.

The code for this in java would look like this:

DigitalInput limitSwitch = new DigitalInput(3); The constructor argument is the port its plugged into on the io board.

Then to get a Boolean value of weather it is closed or not use limitSwitch.get();

Good Luck!

im using labview

There’s a sub-forum under “Programming” specifically for LabVIEW.

If you post there, you increase the chances that your post will be read by LabVIEW programmers.