Quote:
Originally Posted by s0crates
I think you may be missing the (hidden) easiest route: the jags have built in ports for limit switches.
|
Regrettably, FIRST has made that illegal this year to reduce the number of new things being introduced. See
this Q&A response.
The attached is a screenshot of how I handled limit switches. This is a subvi that comes off of teleop.vi in the advanced framework. I've built the motor device reference and the limit switches into a typedef and passed them into the subvi. If you're in the basic framework you could open the devices in the same part of the code that the drive motors are opened, pass the references into the teleop execute case, and then drop something like this code in.
Basically, if the input signal is sending the turret left, it checks the left limit switch and stops if the switch is active, otherwise it does what it was told. If it's sending the turret right, it checks the right limit switch and stops if the switch is active and does what it's told otherwise. It checks each time teleop runs within the main loop. The extra indicators are not required - they just make it easy to see what's going on with the limit switches from the front panel of the vi.