Skip to content

Commit fd3ad93

Browse files
authored
Merge pull request #101 from pimoroni/patch-ads1115
Add support for ADS1115
2 parents 587800a + 27ab20d commit fd3ad93

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

library/enviroplus/gas.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,19 @@ def __repr__(self):
4141

4242

4343
def setup():
44-
global adc, _is_setup
44+
global adc, adc_type, _is_setup
4545
if _is_setup:
4646
return
4747
_is_setup = True
4848

4949
adc = ads1015.ADS1015(i2c_addr=0x49)
50+
adc_type = adc.detect_chip_type()
5051
adc.set_mode('single')
5152
adc.set_programmable_gain(MICS6814_GAIN)
52-
adc.set_sample_rate(1600)
53+
if adc_type == 'ADS1115':
54+
adc.set_sample_rate(128)
55+
else:
56+
adc.set_sample_rate(1600)
5357

5458
GPIO.setwarnings(False)
5559
GPIO.setmode(GPIO.BCM)

library/setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ install_requires =
3232
pms5003
3333
ltr559
3434
st7735
35-
ads1015
35+
ads1015 >= 0.0.7
3636
fonts
3737
font-roboto
3838
astral

0 commit comments

Comments
 (0)