diff --git a/examples/indoor-air-quality.py b/examples/indoor-air-quality.py index 760cce9..0a60643 100755 --- a/examples/indoor-air-quality.py +++ b/examples/indoor-air-quality.py @@ -12,7 +12,10 @@ Press Ctrl+C to exit """) -sensor = bme680.BME680() +try: + sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY) +except IOError: + sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY) # These oversampling settings can be tweaked to # change the balance between accuracy and noise in diff --git a/examples/read-all.py b/examples/read-all.py index fe24da1..1c23ed0 100755 --- a/examples/read-all.py +++ b/examples/read-all.py @@ -8,7 +8,10 @@ Press Ctrl+C to exit """) -sensor = bme680.BME680() +try: + sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY) +except IOError: + sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY) # These calibration data can safely be commented # out, if desired. diff --git a/examples/temp-offset.py b/examples/temp-offset.py index fba26c7..2ccd73d 100755 --- a/examples/temp-offset.py +++ b/examples/temp-offset.py @@ -4,7 +4,10 @@ import bme680 print("""Display Temperature, Pressure and Humidity with different offsets. """) -sensor = bme680.BME680() +try: + sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY) +except IOError: + sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY) # These oversampling settings can be tweaked to # change the balance between accuracy and noise in diff --git a/examples/temp-press-hum.py b/examples/temp-press-hum.py index af32ad8..8a2702d 100755 --- a/examples/temp-press-hum.py +++ b/examples/temp-press-hum.py @@ -10,7 +10,10 @@ Press Ctrl+C to exit """) -sensor = bme680.BME680() +try: + sensor = bme680.BME680(bme680.I2C_ADDR_PRIMARY) +except IOError: + sensor = bme680.BME680(bme680.I2C_ADDR_SECONDARY) # These oversampling settings can be tweaked to # change the balance between accuracy and noise in