Simple test

Ensure your device works with this simple test.

examples/ccs811_simpletest.py
 1# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
 2# SPDX-License-Identifier: MIT
 3
 4import time
 5import board
 6import adafruit_ccs811
 7
 8i2c = board.I2C()  # uses board.SCL and board.SDA
 9# i2c = board.STEMMA_I2C()  # For using the built-in STEMMA QT connector on a microcontroller
10ccs811 = adafruit_ccs811.CCS811(i2c)
11
12# Wait for the sensor to be ready
13while not ccs811.data_ready:
14    pass
15
16while True:
17    print("CO2: {} PPM, TVOC: {} PPB".format(ccs811.eco2, ccs811.tvoc))
18    time.sleep(0.5)