View Single Post
  #2   Spotlight this post!  
Unread 10-01-2007, 19:56
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: Potentiometer with ADC

It's pretty simple. Wire the potentiometer to a PWM cable (I forget how to do this since I didn't do it), and plug it into one of the appropriate RC inputs. I'm fairly sure that the white cable of the PWM cable is the signal line, while the red and black ones are positive and ground. Once it is set up, it should simply be the potentiometer with the PWM cable hanging off it. There is no need for additional wires or power.

Once you've done that, you can access whatever values it is reading with the function Get_Analog_Value(int whichInput).

For example, our potentiometer in the 2006 robot, we did:
Code:
curPotentReading = Get_Analog_Value(rc_ana_in03)
If I remember correctly, the returned value will be between 0 and 1024, since it is a 10-bit ADC.