From 9647753770c0c7543aff548648474f02290813b6 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 12 Feb 2025 16:06:54 -0600 Subject: [PATCH] try new I2C address in examples --- examples/mlx90393_simpletest.py | 7 ++++++- examples/mlx90393_temperature.py | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/examples/mlx90393_simpletest.py b/examples/mlx90393_simpletest.py index b160216..b329475 100755 --- a/examples/mlx90393_simpletest.py +++ b/examples/mlx90393_simpletest.py @@ -7,7 +7,12 @@ i2c = board.I2C() # uses board.SCL and board.SDA # i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller -SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X) +try: + SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X) +except ValueError: + SENSOR = adafruit_mlx90393.MLX90393( + i2c, gain=adafruit_mlx90393.GAIN_1X, address=0x18 + ) while True: MX, MY, MZ = SENSOR.magnetic diff --git a/examples/mlx90393_temperature.py b/examples/mlx90393_temperature.py index 942bc1c..871014d 100644 --- a/examples/mlx90393_temperature.py +++ b/examples/mlx90393_temperature.py @@ -7,7 +7,12 @@ i2c = board.I2C() # uses board.SCL and board.SDA # i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller -SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X) +try: + SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X) +except ValueError: + SENSOR = adafruit_mlx90393.MLX90393( + i2c, gain=adafruit_mlx90393.GAIN_1X, address=0x18 + ) while True: