View Single Post
  #6   Spotlight this post!  
Unread 05-02-2014, 12:17
RamZ's Avatar
RamZ RamZ is offline
Project Manager & Driver
AKA: Ram Zallan
FRC #0004 (Team 4 ELEMENT)
Team Role: Leadership
 
Join Date: Feb 2013
Rookie Year: 2012
Location: Los Angeles
Posts: 127
RamZ will become famous soon enoughRamZ will become famous soon enough
Re: Programming a Potentiometer

Quote:
Originally Posted by mmaunu View Post
You can map the values from the potentiometer without testing them, but I would only feel really good about it after verifying the numbers on the pot itself. You can map the values by taking the range of the pot's motion (for a 270 degree pot, this would be 270) and dividing it by the max output power (probably 5 Volts).

270/5 gives you 54 degrees per volt. One end of the pot will read 0 volts and a rotation of 54 degrees should give you a reading of 1 volt. This assumes that it is a linear pot (as opposed to a logarithmic pot).

With the AnalogChannel class, you can get the voltage or the scaled analog value (which is in the range 0 to 1023). The AnalogPotentiometer class gives the voltage by default and has a constructor that allows you to scale the values to more meaningful units.

Sorry if this is scattered...I am doing it between bits of teaching
Thanks a ton! This actually makes sense to me now

It's my first year programming our robot hands on, so I was a bit confused, but this helped clear it up. I'll be in robotics around 4, so I'll check which type of pot we have then.
__________________
Team 4 ELEMENT
Project Manager & Driver
team4element.com facebook twitter instagram


Reply With Quote