Then it should look something like this, probably not exactly though...
Code:
DigitalInput ballCounter = new DigitalInput(I/O slot);
As for wiring it, you're going to want to take a PWM cable, clip off the male end, and solder the red and black wires to either terminal on the switch. Then plug the PWM into the digital i/o slot on your digital sidecar in the appropriate slot, and orientation.