Code not responding to Limit Switch Signal

We are having problems with our limit switches. We are trying to use our switches to prevent our manipulator from going past a certain point, but when the switch is hit the manipulator doesn’t stop. The manipulator is working and the switch is sending a signal though. We think our code could be the problem, but the switcch itself is working just it isn’t triggering the operation we want.

We had the exact same issue issue. The way we solved it was just a meticulous look at the code and wiring. Make sure your code is using the correct refnum names for each switch (same between begin and teleop vi’s). Take a look at the wiring to see if the switches are ‘Normaly Open’ or ‘Normally Closed’ and make sure the code is reacting accordingly. And lastly triple check the channels set in the code vs what is actually wired in the sidecar.

If you think your code could be the problem, you’ll probably need to show it to us before you can get any useful advice.

I can not get our code image to pull up but I was able to include a link to our blog with the code on it. THANK YOU for any help you are able to provide!

doodlethingy.doc (4 Bytes)

doodlethingy.doc (4 Bytes)

Is this in Teleop? More information would be fantastic. Until then, all we can really say is “Check your references, probe the Digital Get’s to make sure they trip when you want, check that you aren’t over-riding the value somewhere, etc.” You can post .vi’s, you can post your whole project if you zip it.

Is the limit switch wired as Normally Open or the opposite?

Does the operation work if the arm is moving very slowly? Remember that the limit switch is only being tested once for each execution of the loop. If the limit switch is only set for a small period, it is possible for the switch to be set and then rotate past to the point that it is not set between executions of the loop. When you are using a limit switch, you will find that the ending position will not be exactly the same each time that the limit is reached. The speed of the arm and repetition rate of the loop cause some uncertainty.

Excellent point. I set up our code so that there is a dedicated, 10ms loop that just checks the limit switch and stops the motor.

However, that’s probably not the real problem.

What did you check to make sure the limit switch worked? If it was somewhere within teleop (with a probe or an indicator or something), then it’s probably just how you stopped the motor. If it was that your heard a clicky sound or used a multimeter, it could be anything.

EDIT: I just looked at the program, and it seems as if you will stop the actuator if either switch is pressed. If you have one at the top of the reach and one at the bottom, this is not what you want. I’ll attach what we did for limit switches.

Limit (6.5 KB)

Limit (6.5 KB)