|
20 | 20 |
|
21 | 21 | **Software and Dependencies:**
|
22 | 22 |
|
23 |
| -* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards: |
24 |
| - https://github.com/adafruit/circuitpython/releases |
| 23 | +* Adafruit CircuitPython firmware for the supported boards: |
| 24 | + https://github.com/adafruit/circuitpython/releases |
25 | 25 | * Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
|
26 | 26 |
|
27 | 27 | """
|
@@ -63,8 +63,34 @@ def _crc16(data):
|
63 | 63 | class AM2320:
|
64 | 64 | """A driver for the AM2320 temperature and humidity sensor.
|
65 | 65 |
|
66 |
| - :param i2c_bus: The `busio.I2C` object to use. This is the only required parameter. |
67 |
| - :param int address: (optional) The I2C address of the device. |
| 66 | + :param ~busio.I2C i2c_bus: The I2C bus the AM2320 is connected to. |
| 67 | + This is the only required parameter. |
| 68 | + :param int address: (optional) The I2C address of the device. Defaults to :const:`0x5C` |
| 69 | +
|
| 70 | + **Quickstart: Importing and using the AM2320** |
| 71 | +
|
| 72 | + Here is an example of using the :class:`AM2320` class. |
| 73 | + First you will need to import the libraries to use the sensor |
| 74 | +
|
| 75 | + .. code-block:: python |
| 76 | +
|
| 77 | + import board |
| 78 | + import adafruit_am2320 |
| 79 | +
|
| 80 | + Once this is done you can define your `board.I2C` object and define your sensor object |
| 81 | +
|
| 82 | + .. code-block:: python |
| 83 | +
|
| 84 | + i2c = board.I2C() # uses board.SCL and board.SDA |
| 85 | + am = adafruit_am2320.AM2320(i2c) |
| 86 | +
|
| 87 | + Now you have access to the temperature using :attr:`temperature` attribute and |
| 88 | + the relative humidity using the :attr:`relative_humidity` attribute |
| 89 | +
|
| 90 | + .. code-block:: python |
| 91 | +
|
| 92 | + temperature = am.temperature |
| 93 | + relative_humidity = am.relative_humidity |
68 | 94 |
|
69 | 95 | """
|
70 | 96 |
|
@@ -108,7 +134,7 @@ def _read_register(self, register, length):
|
108 | 134 |
|
109 | 135 | @property
|
110 | 136 | def temperature(self):
|
111 |
| - """The measured temperature in celsius.""" |
| 137 | + """The measured temperature in Celsius.""" |
112 | 138 | temperature = struct.unpack(">H", self._read_register(AM2320_REG_TEMP_H, 2))[0]
|
113 | 139 | if temperature >= 32768:
|
114 | 140 | temperature = 32768 - temperature
|
|
0 commit comments