If you are reading an 8-bit a/d converter, then your input will be from 0 to 255. The scaling depends on your reference. typically, for cheap setups, this is Vin. If your Vin is 3.0 volts, you divide that by 256 to see how many volts each bit is worth. 3/256=.0117. So, if you get a reading of 200, your voltage is just over 2.3. Just plug the math in to convert it in code, or for more compact code, simply use precalculated constants.
Bookmarks