Skip to content

Instantly share code, notes, and snippets.

@janjagusch
Created January 4, 2021 08:51
Show Gist options
  • Save janjagusch/f5e1c4c0543e11c150581b90c90c5bb7 to your computer and use it in GitHub Desktop.
Save janjagusch/f5e1c4c0543e11c150581b90c90c5bb7 to your computer and use it in GitHub Desktop.
Adafruit CircuitPython CCS811 Drive Mode Test
"""
https://github.com/adafruit/Adafruit_CircuitPython_CCS811/issues/43
"""
import time
import board
import busio
import adafruit_ccs811
i2c = busio.I2C(board.SCL, board.SDA)
ccs811 = adafruit_ccs811.CCS811(i2c)
# Adjust drive mode
# Now measurement should only change every 10 seconds.
ccs811.drive_mode = adafruit_ccs811.DRIVE_MODE_10SEC
# Wait for the sensor to be ready
while not ccs811.data_ready:
pass
while True:
print("CO2: {} PPM, TVOC: {} PPB".format(ccs811.eco2, ccs811.tvoc))
time.sleep(0.5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment