Adafruit_CircuitPython_CCS811/examples/ccs811_simpletest.py
Brennen Bearnes 1b958bc0f5 s/adafruit_CCS811/adafruit_ccs811/ in simple test
Just fixes an import failure.  The module is still not, to my knowledge,
in a working state.
2018-08-14 10:27:20 -06:00

20 lines
406 B
Python

import time
from board import SCL, SDA
import busio
import adafruit_ccs811
i2c_bus = busio.I2C(SCL, SDA)
ccs = adafruit_ccs811.CCS811(i2c_bus)
#wait for the sensor to be ready and calibrate the thermistor
while not ccs.data_ready:
pass
temp = ccs.temperature
ccs.temp_offset = temp - 25.0
while True:
print("CO2: ", ccs.eco2, " TVOC:", ccs.tvoc, " temp:", ccs.temperature)
time.sleep(.5)