View Single Post
  #5   Spotlight this post!  
Unread 18-02-2010, 23:34
Geek 2.0 Geek 2.0 is offline
Registered User
FRC #0107
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2008
Location: Holland, MI
Posts: 120
Geek 2.0 will become famous soon enough
Re: wiring the 2010 digital limit switches

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).