|
Re: wiring the 2010 digital limit switches
Quote:
Originally Posted by Geek 2.0
Visuals are always awesome!
So here's the explanation...
NC = Normally Closed
NO = Normally Open
When you push the switch, it disconnects COM and NC and connects COM and NO. Otherwise, NC and COM are connected.
The Digital Sidecar has something called "Internal Pull-ups". This means that when the signal wire (the white one) isn't connected to anything, it will read logical true. However, when you push the switch, the connection to ground (the black wire) overrides this internal pull-up and pulls it to logical false. The heatshrink on the red wire is to prevent any shorting. In reality, it's not a big deal, but it's safer that way.
What does this mean for code? Well, here's some pseudocode to explain it:
If limitSwitch is False Do what you're supposed to do when the switch IS triggered Else Do what you're supposed to do when the switch is NOT triggered I know it seems backwards, but you'll get used to it. If you need language specific help, feel free to message me (or post back, whatever you're most comfortable with).
|
Hi Im Joe from team 3017
we are now trying to use the limit switch. However, do you know how to program it? Or where to find the file in WPILib. By the way, I'm using C++.
THANKS
__________________
[font="Fixedsys"][b]We Don't Hope We will.
|