adafruit / Adafruit_ADS1X15

Driver for TI's ADS1015: 12-bit Differential or Single-Ended ADC with PGA and Comparator
Other
289 stars 301 forks source link

Examples wrongly suggest that mV are shown. but Volts are #87

Closed Jeroen88 closed 7 months ago

Jeroen88 commented 8 months ago

The function float Adafruit_ADS1X15::computeVolts(int16_t counts) does what it says: it computes the Volts. However, in the examples the value is presented as if it where mV, see e.g. here.

A quick fix would be to call computeVolts(1000 * results) however since the function parameter is just an int16_t it will quickly overflow. I would suggest adding a new (trivial) function computeMilliVolts(int16_t counts) and call that function instead in the examples.