Need Help Wiring Micro Switch/Limiting Switch

Our team has been having some problems with our cannon panning too much, and so I’m trying to wire a couple limiting switches on either end of arc on which the cannon pans, so that when it hits the switch, it will switch directions. The micro switch that came in the kit (made by Sager Electronics, part # V7-2B17D8-048) has 3 pins on it, labeled NC2, NC3 and COM1. I figured that NC2 and NC3 should be wired to Digital In/Out +5V/GND and then the COM1 pin connects to SIG. However I wasn’t sure, so I just wanted to see if anyone out there already knew how to wire this switch.
Also if anyone knows how to program a motor to switch directions when the switch is hit, that would be great as well. Our programming guys seem to know how to program it, but I figured an experienced voice can never hurt.

That’s a single-pole double-throw switch. If you look closely, you’ll see that the pins are marked COM 1, NC 2, and NO 3. Pin 1 is the common terminal, pin 2 is the normally closed contact, and pin 3 is the normally open contact. When the switch is not being activated, pins 1 and 2 are connected together. When the switch is being activated, pins 1 and 3 are connected together.

The Robot Controller digital inputs have an internal pullup resistor to +5 volts on the signal pin, so all you need to do in order to make them work is provide a switched path between the ground and signal pins. That’s pins 1 and 2 on the switch if you want the value to be 1 when the switch is activated, or pins 1 and 3 on the switch if you want the value to be 0. Leave the unused pin unconnected, and do not connect +5 to the switch at all.

I can answer the electrical problem, software people are asked to chime in after that. You only want to wire one of the terminals to ground or the battery common and the “common” terminal to a digital input. When the switch is open it will be read as a “1” and when closed it will be read as a “0”. Often the switches are marked NO for normally open and NC for normally closed with reference to the common terminal.