Programming a Kill Switch

Hello, I have a switch and when I press it I want it to shut off/stop (kill switch) a motor from being able to spin in that direction. How would I program this? Also, does anyone have any examples of how to program a magnetic reed switch? I want a pneumatic cylinder to stop extending at a certain point. Thanks!

Allons-y

Not being a programmer, I can’t really help you. But I can offer some advice about pneumatic cylinders. Stopping a pneumatic cylinder before the end of its stroke is not generally a good idea. Since air compresses, it will move if any load changes on it. Just be aware of that.

A recent post shows the typical LabVIEW idiom for implementing limit switches. Look at the diagram on the right half of the image attached to it. It uses the “in range and coerce” function to keep a motor from going forward if one switch is active, and to keep it from going backward if another switch is active.

Fantastic! Thank you very much.