Log in

View Full Version : How to attach and code fsp 8268909?


ShaneWong
08-02-2015, 08:33
Hi I'm from team 4732, I've been having trouble figuring out how to attach/program this button (http://www.repairclinic.com/PartDetail/Micro-Switch/8268909/830916). Any help you could offer would be greatly appreciated.

otherguy
08-02-2015, 09:58
Wire one side of the switch to ground and the other to a digital input channel.

On the programming side, look at the DigitalInput class:
http://team2168.org/javadoc/edu/wpi/first/wpilibj/DigitalInput.html

curtis0gj
10-02-2015, 06:41
I was struggling for a long time trying to figure out how to program these to stop motors when pressed and if that's your plan check out this thread: http://www.chiefdelphi.com/forums/showthread.php?t=133983&page=4

Ozuru
10-02-2015, 11:13
It is hooked up to a PWM cable. You only need to wire the ground and signal (black and white, respectively) as the positive (red) wire has no use in a switch. Instead of plugging it into the PWM section of your RoboRIO, plug it into the section designated for digital inputs.

Programming side:


DigitalInput _switch1 = new DigitalInput(0);
if(_switch1.get) {
System.out.println("Switch 1 is pressed!");
}