Analog Breakout?

We want to use a honeywell microswitch as a ball counter to determine the amount of balls the robot is currently holding. How do we connect this up and program for it? I think we connect this to the analog breakout but I’m not sure. Thanks in advance.
http://www.usfirst.org/uploadedFiles/Robotics_Programs/FRC/Game_and_Season__Info/2011_Assets/Kit_of_Parts/Honeywell%20Microswitch.pdf

What language are you using to program your robot? Also, you can just put that on a i/o slot on your digital sidecar, analogue breakout is more for values between 0 and 1, not high-low values.

We are going to program in java. And how would we connect the cables to the microswitch?

Then it should look something like this, probably not exactly though…

 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.

Okay, thanks

No problem.

Don’t do this.

Red is +5 volts. Black is the power return. If the switch makes contact, it’ll short out the 5 volt supply on your Digital Sidecar. The supply is protected against this, so it won’t be ruined, but everything else connected to +5 will lose power for the duration of the switch activation.

What you should use are the black (-) and white or yellow (signal) wires. Black goes to the Common terminal on the microswitch. The signal wire connects to either the Normally Open or the Normally Closed terminal.

Agreed x100.

I will add that it is IMHO good practice to use a pick to undo the red wire’s clip at the female end and remove the cable and metal terminal from the plug… you could call it extra insurance against shorting.

I apologize for the misinformation, that was how i was told to do it by last year’s seniors, glad i have never put it into practice myself. Thanks for the info.

My personal preference is to fold back the power wire and heat shrink it so that the wire can’t ever complete a circuit unless it’s immersed in saline.