Skip to content

Commit e78e054

Browse files
committed
lint and addr
1 parent 9a5a329 commit e78e054

File tree

4 files changed

+21
-14
lines changed

4 files changed

+21
-14
lines changed

I2C_Multiple_Same_Address/arduino/multi_bme280_2x/multi_bme280_2x.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ void setup() {
1818

1919
// In the call to begin, pass in the I2C address.
2020
// If left out, the default address is used.
21-
bme1.begin(); // use the default address of 0x77
22-
bme2.begin(0x76); // specify the alternate address of 0x76
21+
// But also OK to just be explicit and specify.
22+
bme1.begin(0x77); // address = 0x77 (default)
23+
bme2.begin(0x76); // address = 0x76
2324
}
2425

2526

I2C_Multiple_Same_Address/circuitpython/multi_bme280_2x/code.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,15 @@
99
# Get the board's default I2C port
1010
i2c = board.I2C()
1111

12+
#--------------------------------------------------------------------
13+
# NOTE!!! This is the "special" part of the code
14+
#
1215
# Create each sensor instance
13-
bme1 = adafruit_bme280.Adafruit_BME280_I2C(i2c) # default 0x77 address
14-
bme2 = adafruit_bme280.Adafruit_BME280_I2C(i2c, 0x76) # alternate 0x76 address
16+
# If left out, the default address is used.
17+
# But also OK to be explicit and specify address.
18+
bme1 = adafruit_bme280.Adafruit_BME280_I2C(i2c, 0x77) # address = 0x77
19+
bme2 = adafruit_bme280.Adafruit_BME280_I2C(i2c, 0x76) # address = 0x76
20+
#--------------------------------------------------------------------
1521

1622
print("Two BME280 Example")
1723

@@ -24,4 +30,4 @@
2430
print("BME280 #1 Pressure =", pressure1)
2531
print("BME280 #2 Pressure =", pressure2)
2632

27-
time.sleep(1)
33+
time.sleep(1)

I2C_Multiple_Same_Address/circuitpython/multi_bme280_3x/code.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
# NOTE!!! This is the "special" part of the code
1818
#
1919
# Create each BME280 using the TCA9548A channel instead of the I2C object
20-
bme1 = adafruit_bme280.Adafruit_BME280_I2C(tca[0])
21-
bme2 = adafruit_bme280.Adafruit_BME280_I2C(tca[1])
22-
bme3 = adafruit_bme280.Adafruit_BME280_I2C(tca[2])
20+
bme1 = adafruit_bme280.Adafruit_BME280_I2C(tca[0]) # TCA Channel 0
21+
bme2 = adafruit_bme280.Adafruit_BME280_I2C(tca[1]) # TCA Channel 1
22+
bme3 = adafruit_bme280.Adafruit_BME280_I2C(tca[2]) # TCA Channel 2
2323
#--------------------------------------------------------------------
2424

2525
print("Three BME280 Example")
@@ -35,4 +35,4 @@
3535
print("BME280 #2 Pressure =", pressure2)
3636
print("BME280 #3 Pressure =", pressure3)
3737

38-
time.sleep(1)
38+
time.sleep(1)

I2C_Multiple_Same_Address/circuitpython/multi_bme280_4x/code.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
# NOTE!!! This is the "special" part of the code
1818
#
1919
# Create each BME280 using the TCA9548A channel instead of the I2C object
20-
bme1 = adafruit_bme280.Adafruit_BME280_I2C(tca[0])
21-
bme2 = adafruit_bme280.Adafruit_BME280_I2C(tca[1])
22-
bme3 = adafruit_bme280.Adafruit_BME280_I2C(tca[2])
23-
bme4 = adafruit_bme280.Adafruit_BME280_I2C(tca[3])
20+
bme1 = adafruit_bme280.Adafruit_BME280_I2C(tca[0]) # TCA Channel 0
21+
bme2 = adafruit_bme280.Adafruit_BME280_I2C(tca[1]) # TCA Channel 1
22+
bme3 = adafruit_bme280.Adafruit_BME280_I2C(tca[2]) # TCA Channel 2
23+
bme4 = adafruit_bme280.Adafruit_BME280_I2C(tca[3]) # TCA Channel 3
2424
#--------------------------------------------------------------------
2525

2626
print("Four BME280 Example")
@@ -38,4 +38,4 @@
3838
print("BME280 #3 Pressure =", pressure3)
3939
print("BME280 #4 Pressure =", pressure4)
4040

41-
time.sleep(1)
41+
time.sleep(1)

0 commit comments

Comments
 (0)