Limit Switch and Button

I am a programmer for Team 3711 (Trout Lake Mustangs) and want to know if I can have a Limit Switch AND a Button. :confused: We have the joystick trigger running a cylinder but want a Limit Switch in series with the trigger. Is that possible to have (switch and trigger)? Most likely this will be two case statements in series. If so, I need help please. P.S. If it is possible, can you post your Vi so I can download it to se what to do?::rtm::
Thanks, Emily.

So you want to run the piston only when the limit switch and button are pressed? could you explain what you want the limit switch and the button to do?

ex. piston fires only when both limit and button are pressed
ex. piston fires when limit is not pressed but button is

It sounds like you want to do this in LabVIEW. You might be interested in the boolean functions such as AND and OR. You can make it so that you need two simultaneous conditions in order to trigger an action.

Thanks for your responses. Our team is now actually running a FP motor off the x-axis of a second joystick and needs a limit switch so we don’t swallow our lead screw (the cylinder got used elsewhere.)
We’re going to mess with this now, but I think the and statement is going to be the answer. The trick will be to have the limit switch stop travel in one direction but still make the reverse (retracting) motion of the motor available in order to unswitch the limit switch lever.

For making the limit switch stop the motor only one way you want the in range and coerce function found in the comparison pallet. This will allow you to set the upper limit or lower limit to zero when the limit switch is pressed depending on what way you don’t want the motor to spin (upper is positive and lower is negative direction)

After considerable thrashing at the in range and coerce icon I’m unable to set the limits. I see the (apparent) array in the NI example but don’t see how to set the constants.
And does this function occur within a true / false case structure controlled by the limit switch DI?
I’m giving up for the duration of the superbowl…
Thanks for any leads, or example code or links to same.

One way to do it is to use Select nodes to change the limit for the In Range and Coerce between 1 or -1 and 0 if the switch is pressed.

EDIT: You should make sure to right click on the In Range and Coerce function and check that both ā€œInclude Upper Limitā€ and ā€œInclude Lower Limitā€ are checked.

LimitSwitch.jpg


LimitSwitch.jpg

I think your DIO checks are reversed…

The DIO’s are True by default and False when a switch is pressed.

Whoops! Right you are. I’ll fix up the image right now.

EDIT: Image should be fixed now.

Well, it would have worked the other way as long as the limit switches were wired to be Normally-Closed.

But it looks good now for Normally-Opened, like most people tend to automatically think of a switch. :slight_smile:

Bill,

If you are only limiting in one direction, you can just wire a constant -1 to the side you aren’t limiting of the ā€œIn Range and Coerceā€ VI. No need to check the switch or use the select statement.

Hah, that’s classic. We’re just about to get the second limit switch hooked up and were starting to figure how to get both in one section of code. You solved that problem of course at the same time you pointed out my extra work on the last one. I should have noticed the two different switches in your example…
I think I’ll delete my other post with the misleading code.
Thanks again, nice glacier point pic by the way.