|
21 | 21 |
|
22 | 22 | **Software and Dependencies:**
|
23 | 23 |
|
24 |
| -* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: |
25 |
| - https://github.com/adafruit/circuitpython/releases |
| 24 | +* Adafruit CircuitPython firmware for the supported boards: |
| 25 | + https://circuitpython.org/downloads |
| 26 | +
|
26 | 27 | * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
|
27 | 28 | """
|
28 | 29 | from micropython import const
|
|
67 | 68 |
|
68 | 69 |
|
69 | 70 | class VCNL4010:
|
70 |
| - """Vishay VCNL4010 proximity and ambient light sensor.""" |
| 71 | + """Vishay VCNL4010 proximity and ambient light sensor. |
| 72 | +
|
| 73 | + :param ~busio.I2C i2c: The I2C bus the VCNL4010 is connected to |
| 74 | + :param int address: (optional) The I2C address of the device. Defaults to :const:`0x13` |
| 75 | +
|
| 76 | + **Quickstart: Importing and using the VCNL4010** |
| 77 | +
|
| 78 | + Here is an example of using the :class:`VCNL4010` class. |
| 79 | + First you will need to import the libraries to use the sensor |
| 80 | +
|
| 81 | + .. code-block:: python |
| 82 | +
|
| 83 | + import board |
| 84 | + import adafruit_vcnl4010 |
| 85 | +
|
| 86 | + Once this is done you can define your `board.I2C` object and define your sensor object |
| 87 | +
|
| 88 | + .. code-block:: python |
| 89 | +
|
| 90 | + i2c = board.I2C() # uses board.SCL and board.SDA |
| 91 | + sensor = adafruit_vcnl4010.VCNL4010(i2c) |
| 92 | +
|
| 93 | + Now you have access to the :attr:`sensor.proximity` and |
| 94 | + :attr:`ambient_lux` attributes |
| 95 | +
|
| 96 | +
|
| 97 | + .. code-block:: python |
| 98 | +
|
| 99 | + proximity = sensor.proximity |
| 100 | + ambient_lux = sensor.ambient_lux |
| 101 | +
|
| 102 | + """ |
71 | 103 |
|
72 | 104 | # Class-level buffer for reading and writing data with the sensor.
|
73 | 105 | # This reduces memory allocations but means the code is not re-entrant or
|
@@ -127,7 +159,7 @@ def led_current_mA(self):
|
127 | 159 | supports current changes in 10mA increments, i.e. a value of 123 mA will
|
128 | 160 | actually use 120 mA. See the datasheet for how the LED current impacts
|
129 | 161 | proximity measurements, and the led_current property to explicitly set
|
130 |
| - values without quanitization or unit conversion. |
| 162 | + values without quantization or unit conversion. |
131 | 163 | """
|
132 | 164 | return self.led_current * 10
|
133 | 165 |
|
@@ -186,7 +218,7 @@ def proximity(self):
|
186 | 218 | def ambient(self):
|
187 | 219 | """The detected ambient light in front of the sensor. This is
|
188 | 220 | a unit-less unsigned 16-bit value (0-65535) with higher values for
|
189 |
| - more detected light. See the ambient_lux property for a value in lux. |
| 221 | + more detected light. See the :attr:`ambient_lux property` for a value in lux. |
190 | 222 | """
|
191 | 223 | # Clear interrupt.
|
192 | 224 | status = self._read_u8(_VCNL4010_INTSTAT)
|
|
0 commit comments