Skip to content

improving_docs #16

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 29, 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
5 changes: 2 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,13 @@ To install in a virtual environment in your current project:
Usage Example
=============

.. code-block:: python
.. code-block:: python3

import time
import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
veml7700 = adafruit_veml7700.VEML7700(i2c)

while True:
Expand Down
38 changes: 19 additions & 19 deletions adafruit_veml7700.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@

**Hardware:**

* `Adafruit VEML7700 <https://www.adafruit.com/products>`_
* `Adafruit VEML7700 Lux Sensor - I2C Light Sensor
<https://www.adafruit.com/product/4162>`_ (Product ID: 4162)

**Software and Dependencies:**

* Adafruit CircuitPython firmware for the supported boards:
https://github.com/adafruit/circuitpython/releases
https://circuitpython.org/downloads

* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
* Adafruit's Register library: https://github.com/adafruit/Adafruit_CircuitPython_Register
* Adafruit's Bus Device library:
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice

* Adafruit's Register library:
https://github.com/adafruit/Adafruit_CircuitPython_Register
"""

from micropython import const
Expand All @@ -40,7 +44,8 @@
class VEML7700:
"""Driver for the VEML7700 ambient light sensor.

:param busio.I2C i2c_bus: The I2C bus the VEML7700 is connected to.
:param ~busio.I2C i2c_bus: The I2C bus the device is connected to
:param int address: The I2C device address. Defaults to :const:`0x10`

"""

Expand Down Expand Up @@ -87,10 +92,9 @@ class VEML7700:

import time
import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
veml7700 = adafruit_veml7700.VEML7700(i2c)

while True:
Expand All @@ -108,10 +112,9 @@ class VEML7700:

import time
import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
veml7700 = adafruit_veml7700.VEML7700(i2c)

while True:
Expand All @@ -134,10 +137,9 @@ class VEML7700:

import time
import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
veml7700 = adafruit_vcnl4040.VCNL4040(i2c)

veml7700.light_gain = veml7700.ALS_GAIN_2
Expand All @@ -158,10 +160,9 @@ class VEML7700:

import time
import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
veml7700 = adafruit_vcnl4040.VCNL4040(i2c)

veml7700.light_integration_time = veml7700.ALS_400MS
Expand Down Expand Up @@ -196,18 +197,18 @@ def __init__(self, i2c_bus, address=0x10):
raise RuntimeError("Unable to enable VEML7700 device")

def integration_time_value(self):
"""Integration time value in integer form. Used for calculating ``resolution``."""
"""Integration time value in integer form. Used for calculating :meth:`resolution`."""
integration_time = self.light_integration_time
return self.integration_time_values[integration_time]

def gain_value(self):
"""Gain value in integer form. Used for calculating ``resolution``."""
"""Gain value in integer form. Used for calculating :meth:`resolution`."""
gain = self.light_gain
return self.gain_values[gain]

def resolution(self):
"""Calculate the ``resolution`` necessary to calculate lux. Based on integration time and
gain settings."""
"""Calculate the :meth:`resolution`` necessary to calculate lux. Based on
integration time and gain settings."""
resolution_at_max = 0.0036
gain_max = 2
integration_time_max = 800
Expand All @@ -233,10 +234,9 @@ def lux(self):

import time
import board
import busio
import adafruit_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
veml7700 = adafruit_veml7700.VEML7700(i2c)

while True:
Expand Down
4 changes: 4 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,13 @@ Table of Contents
.. toctree::
:caption: Tutorials

Adafruit VEML7700 Lux Sensor - I2C Light Sensor Learning Guide <https://learn.adafruit.com/adafruit-veml7700>

.. toctree::
:caption: Related Products

Adafruit VEML7700 Lux Sensor - I2C Light Sensor <https://www.adafruit.com/product/4162>


.. toctree::
:caption: Other Links
Expand Down
3 changes: 1 addition & 2 deletions examples/veml7700_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_veml7700

i2c = busio.I2C(board.SCL, board.SDA)
i2c = board.I2C() # uses board.SCL and board.SDA
veml7700 = adafruit_veml7700.VEML7700(i2c)

while True:
Expand Down