Adafruit_CircuitPython_CCS811/examples/ccs811_simpletest.py
2019-07-24 07:26:58 -07:00

17 lines
326 B
Python

import time
import board
import busio
import adafruit_ccs811
i2c = busio.I2C(board.SCL, board.SDA)
ccs811 = adafruit_ccs811.CCS811(i2c)
# Wait for the sensor to be ready
while not ccs811.data_ready:
pass
while True:
print("CO2: {} PPM, TVOC: {} PPM"
.format(ccs811.eco2, ccs811.tvoc)
time.sleep(0.5)