Adafruit_CircuitPython_ADS1x15: When in continuous mode, first read returns previous pin value

Using an ADS1115 on a Raspberry Pi 4 with Python3.7

Test case: p1 should return a value around 13200 p2 should return a value close to 0

ads.mode = Mode.CONTINUOUS
ads.data_rate = 860
p1 = AnalogIn(ads, ADS.P1)
p2 = AnalogIn(ads, ADS.P2)

output:

>>> p1.value
13185
>>> p1.value
13156
>>> p1.value
13186
>>> p2.value
13182    <-- incorrect
>>> p2.value
4
>>> p2.value
4
>>> p1.value
4        <-- incorrect
>>> p1.value
13194
>>> p1.value
13181

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 21 (9 by maintainers)

Most upvoted comments

@dherrada This issue is. But if this is a basic behavior of the ADS, then would potentially affect other libraries.

I’ve recreated this issue. Which is weird, as I thought this used to work. Seems like maybe something has changed. I’ll try and investigate also.

@dherrada FYI - the logic that is in place was done as an attempt to provide “fast” reads in a simple way without breaking the current API. There’s a huge discussion here: https://github.com/adafruit/Adafruit_CircuitPython_ADS1x15/issues/27