Skip to content

improving_docs #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------
Expand Down
46 changes: 42 additions & 4 deletions adafruit_ccs811.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
<https://www.adafruit.com/product/3566>`_

**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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Table of Contents
.. toctree::
:caption: Tutorials

Adafruit CCS811 Air Quality Sensor Breakout - VOC and eCO2 Learning Guide <https://learn.adafruit.com/adafruit-ccs811-air-quality-sensor>

.. toctree::
:caption: Related Products

Expand Down
3 changes: 1 addition & 2 deletions examples/ccs811_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down