Skip to content

Commit 8edb395

Browse files
authored
Merge pull request #49 from FoamyGuy/new_address
try new I2C address in examples
2 parents 4e6ba64 + 9647753 commit 8edb395

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

examples/mlx90393_simpletest.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
i2c = board.I2C() # uses board.SCL and board.SDA
99
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
10-
SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X)
10+
try:
11+
SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X)
12+
except ValueError:
13+
SENSOR = adafruit_mlx90393.MLX90393(
14+
i2c, gain=adafruit_mlx90393.GAIN_1X, address=0x18
15+
)
1116

1217
while True:
1318
MX, MY, MZ = SENSOR.magnetic

examples/mlx90393_temperature.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@
77

88
i2c = board.I2C() # uses board.SCL and board.SDA
99
# i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller
10-
SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X)
10+
try:
11+
SENSOR = adafruit_mlx90393.MLX90393(i2c, gain=adafruit_mlx90393.GAIN_1X)
12+
except ValueError:
13+
SENSOR = adafruit_mlx90393.MLX90393(
14+
i2c, gain=adafruit_mlx90393.GAIN_1X, address=0x18
15+
)
1116

1217

1318
while True:

0 commit comments

Comments
 (0)