diff --git a/README.rst b/README.rst index 41d1c41..8b95c48 100644 --- a/README.rst +++ b/README.rst @@ -71,14 +71,14 @@ Next, initialize the I2C bus object. .. code:: python from board import * - i2c_bus = busio.I2C(SCL, SDA) + i2c = board.I2C() # uses board.SCL and board.SDA Once you have created the I2C interface object, you can use it to instantiate the CCS811 object .. code:: python - ccs = adafruit_ccs811.CCS811(i2c_bus) + ccs = adafruit_ccs811.CCS811(i2c) Reading Sensor -------------- diff --git a/adafruit_ccs811.py b/adafruit_ccs811.py index 9e5682c..7cc10dc 100644 --- a/adafruit_ccs811.py +++ b/adafruit_ccs811.py @@ -3,12 +3,25 @@ # SPDX-License-Identifier: MIT """ -`CCS811` - Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2 +`adafruit_ccs811` ====================================================================== This library supports the use of the CCS811 air quality sensor in CircuitPython. Author(s): Dean Miller for Adafruit Industries +**Hardware:** + +* `Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2 + `_ + +**Software and Dependencies:** + +* Adafruit CircuitPython firmware for the supported boards: + https://github.com/adafruit/circuitpython/releases + + * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice + * Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register + **Notes:** #. `Datasheet @@ -61,8 +74,33 @@ class CCS811: """CCS811 gas sensor driver. - :param ~busio.I2C i2c: The I2C bus. - :param int addr: The I2C address of the CCS811. + :param ~busio.I2C i2c_bus: The I2C bus the BME280 is connected to + :param int address: The I2C address of the CCS811. Defaults to :const:`0x5A` + + **Quickstart: Importing and using the CCS811** + + Here is an example of using the :class:`CCS811` class. + First you will need to import the libraries to use the sensor + + .. code-block:: python + + import board + import adafruit_ccs811 + + Once this is done you can define your `board.I2C` object and define your sensor object + + .. code-block:: python + + i2c = board.I2C() # uses board.SCL and board.SDA + ccs811 = adafruit_ccs811.CCS811(i2c) + + Now you have access to the :attr:`eco2` and :attr:`tvoc` attributes. + + .. code-block:: python + + eco2 = ccs811.eco2 + tvoc = ccs811.tvoc + """ # set up the registers @@ -142,7 +180,7 @@ def _update_data(self): @property def baseline(self): """ - The propery reads and returns the current baseline value. + The property reads and returns the current baseline value. The returned value is packed into an integer. Later the same integer can be used in order to set a new baseline. diff --git a/docs/index.rst b/docs/index.rst index 86b8a9a..42bc8cb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,6 +23,8 @@ Table of Contents .. toctree:: :caption: Tutorials + Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2 Learning Guide + .. toctree:: :caption: Related Products diff --git a/examples/ccs811_simpletest.py b/examples/ccs811_simpletest.py index 90b0a15..8b394e5 100644 --- a/examples/ccs811_simpletest.py +++ b/examples/ccs811_simpletest.py @@ -3,10 +3,9 @@ import time import board -import busio import adafruit_ccs811 -i2c = busio.I2C(board.SCL, board.SDA) +i2c = board.I2C() # uses board.SCL and board.SDA ccs811 = adafruit_ccs811.CCS811(i2c) # Wait for the sensor to be ready