In one of the tech support forums, bg-bleah (I think that was the user name) posted the following question:
Unfortunately that forum does not allow general forum members to post replies, so I will post mine here.
In answer to the specific question of how a voltage is converted to a digital value (sometimes referred to as an “Analog Input” because the digital value represents the analog input), there are a number of good explanations on the web, including the answer provided by IFI. It seems most explanations of analog to digital conversion (ADC) on the web are related to measuring voltages over time, such as you would do when digitizing music (repeatedly measuring your arm position is not so different from recording sound). The specifics of how, exactly, that works are perhaps more complex than you want to get in to as a beginner… you can take it that it is done by a “magic black box”. (As Arthur C. Clarke said, “Any sufficiently advanced technology is indistinguishable from magic.”) If you want a quick overview, however, consider that a ten-bit ADC converter can measure 2^10 different values (0-1,023). In this case 0 represents zero volts and 1023 represents 5v (this particular ADC is only good to five volts.) Thus a value of “1” is approximately 5/1023= .005V, while a value of 512 is (5/1023)*512=2.5V
The best way to get a conversion table for rotation to a specific value is to hook up your potentiometer, and move turn it back and forth while using the terminal screen to print out values of that particular input. Do that again with the pot on the robot and you should be able to build a chart of values to arm angles. You may find that your range of values does not go precisely from zero to 1,023 so a bit of experimentation is best.
As for the books, however, there are MANY great books for the budding robot builder. I have pulled one example off my shelf, “123 Robotics Experiments for the Evil Genius” by Myke Predko (McGraw-Hill publishing). Variable resistors (aka potentiometers) are covered on page 52. In fact this book comes with a very high recommendation… one of the students on our FRC team bought it for me as she thought it was a good book that I would like… and she was right.
But there are lots of other good books out there, too. I’m sure that now this is on an open forum that others will post their suggesitons.
Jason