View Single Post
  #1   Spotlight this post!  
Unread 09-02-2008, 20:48
sfs sfs is offline
Registered User
AKA: Steve Siirila
FRC #2220 (Blue Twilight)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Eagan, MN
Posts: 20
sfs is an unknown quantity at this point
Re: Analog-to-digital conversions

Quote:
Originally Posted by BrianBSL View Post
A 1 second delay does not sound normal.

If you are using these for limit switches, you will likely need a pullup resistor (something like 4.7k should work) to 5V, as I don't believe the analog ports have any pullup within the RC like the digital ports do, since a switch works in an open-drain configuration rather than driving rail to rail.
That did it. You guessed correctly that we were simply grounding the signal line and did not include a pullup to +5V. The RC guide on IFI Robotics indicates that a 10K resistor is appropriate, so we used that. In PWM wire terms, we wired black(Gnd) to the switch NO (normally open contact), red(+5V) to the switch NC (normally closed), and white(signal) to the switch COM(common). This worked out fine for us, no delays. We now get values near 0 for a closed switch, and values near 1023 for an open switch (we map 0-511 to CLOSED, 512-1023 to OPEN just to be safe).

Thanks for the tip Brian!