All About Limit Switches
What are limit switches? Simply put, they limit your robot's movement.
Why would you want this? To purposely limit your robot and not let it free, to be the best it can be? Well, sometimes you don't want a part of your robot to move indefinitely. For your robot's main drive, sure, you might want it to move as quickly as possible, but what about an arm?
LogoMotion, the 2011 FRC game, immediately comes to mind. Limit switches have many use cases. Photo: Metrobots 3324
Robot subsystems like these have a limited range of movement. If your robot has a lift, you don't want it to extend as far as it wants or it'll break! Or, how do you know when it's reached the bottom to stop contracting? You could use time, tracking in your program how long the lift has been raising/lowering, but this can easily deviate from it's position in reality. Maybe you'd use an encoder! It's certainly an option, but requires additional program and extra complexity might lead to mistakes.
How about limit switches? With this technique you could put a simple switch at the top and bottom of the lift's range. When the switch is activated your robot will know to not move any further in that direction. How? The SD540C simply has a set of pins you connect the switch to and you're done.
With the mindsensors Configuration Tool you can enable or disable this limit switch functionality. You can also configure each limit switch as normally open or normally closed. Depending on the mechanical setup you may want to use a different setting. Of course, you can use only one limit switch if you just want to limit movement in one direction.
The SD540C also gives you some programmatic options for dealing with limit switches. You can enable/disable them (Java, C++) and set each limit switch as normally open or normally closed (Java, C++), all through the mindsensors FRC library. While you can use only a graphical interface if you'd like (through the mindsensors Configuration Tool), these functions may be useful so you can know for sure they will always be configured correctly at the beginning of a match. RobotInit is a great place for these!
Remember, limit switches connected to the SD540C will already prevent the motor from moving further in that direction (if you have them enabled). However, if you want to perform some more advanced operations, you can also use the mindsensors FRC library to get the current state of the forward (Java, C++) and reverse (Java, C++) limit switches.