View Single Post
  #6   Spotlight this post!  
Unread 29-02-2012, 13:45
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 673
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Wiring a limit switch.

Quote:
Originally Posted by andreboos View Post
Just one more option to consider:

If you're out of Digital I/O ports (like I was this year), you can also wire to the analog breakout. Connect +5v and Signal when the limit switch is engaged, and then check in code whether the analog channel reads above or below 2.5V.
If you are going to connect it using an analog channel, you need some simple circuit than just a switch. If I understand you correctly, you are connecting +5 and Signal to the "Normal Open" or "Normal Close" and "Common" contacts of the switch. In other words, when activated, you either short signal to +5 or leave signal floating. Leaving the signal pin unconnected will read random values. If you really want to use analog channel, you need to use at least one resistor (e.g. a 10K resistor connected between +5 and Signal), then connect the Normal Open to signal and Common to Gnd. When the switch is activated, the signal pin will give you 0V (shorted to Gnd). When the switch is not activated, the signal pin will give you approx. 5V (open).
__________________