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
 9ccs811 = adafruit_ccs811.CCS811(i2c)
10
11# Wait for the sensor to be ready
12while not ccs811.data_ready:
13    pass
14
15while True:
16    print("CO2: {} PPM, TVOC: {} PPB".format(ccs811.eco2, ccs811.tvoc))
17    time.sleep(0.5)