We are trying to have one limit switch set up so that two of our motors will stop running when it is hit. Is it possible to make this single limit switch stop two different motors? If so, how would we go about this?
Hmmm this isn’t quite working. Is there any chance that since we are using the DIO ports instead of directly connecting the limit switches to the motor controllers that it wont work?
Our Refnum Get.vi is brighter green and has “DIO In” instead of “Switch” at the top.
Another thing is that we are trying to shut off our drive motors along with another motor if that makes a difference.
The different motors don’t matter.
Also the DIO vs Switch vi doesn’t matter. The only difference is that the Switch inverts True/False from what the DIO gets.
It’s probably that the limit switch is wired NC (normally closed).
Just try inverting the True/False cases in the snippet.
After playing with the code for a little bit, the one arm motor is working… I can’t get the drive motors to stop when I push the limit switch.
Here is what the code currently looks like…this is a brand new code so that our actual one doesn’t get messed up…
Where can I get the True side to the true and false statement for the left and right motors from?
You don’t want that MC Set.
You need to stop the Arcade Drive on the left side.
You can send both of those joystick wires feeding Arcade Drive through a couple of Selects.
Something like this (I didn’t add in all the regular parts necessary).
Oh that makes sense…
And that worked!! thank you so much!!
Since you are doing so many motor lines, you can also send all of this through a single Case statement, with the False case sending out all zero’s, and the True case just passing the wires through.
Examples of that method:
If you want to do it without any code, plug the limit switch into both motor controllers using a Y-cable. What motor controllers are you using?
They would have to be using a CAN controlled motor controller for that. The code shown only controls PWM motor controllers.
Most PWM motor controllers have slots for limit switch inputs. The CTRE ones will need a breakout board for the input.
Oh yeah that makes sense…
I’ll probably change that tomorrow
Thank you!
yeah we are trying to use CAN this year for our motor controllers rather than PWM. Mainly for a cleaner look.
Even with CAN, you can still wire limit switches directly into the MC’s. Which ones are you using?