Skip to content

Commit e821489

Browse files
committed
Refactor i2c and print statement
1 parent eb94280 commit e821489

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

examples/ccs811_simpletest.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
import busio
44
import adafruit_ccs811
55

6-
i2c_bus = busio.I2C(board.SCL, board.SDA)
7-
ccs811 = adafruit_ccs811.CCS811(i2c_bus)
6+
i2c = busio.I2C(board.SCL, board.SDA)
7+
ccs811 = adafruit_ccs811.CCS811(i2c)
88

99
# Wait for the sensor to be ready and calibrate the thermistor
1010
while not ccs811.data_ready:
@@ -13,6 +13,6 @@
1313
ccs811.temp_offset = temp - 25.0
1414

1515
while True:
16-
print("CO2: %1.0f PPM, TVOC: %1.0f PPM, Temp: %0.1f C" %
17-
(ccs811.eco2, ccs811.tvoc, ccs811.temperature))
16+
print("CO2: {} PPM, TVOC: {} PPM, Temp: {} C"
17+
.format(ccs811.eco2, ccs811.tvoc, ccs811.temperature))
1818
time.sleep(0.5)

0 commit comments

Comments
 (0)