adding_usage_template
This commit is contained in:
parent
a2ae503507
commit
0fa6f4ed76
@ -251,15 +251,17 @@ After the license comment::
|
|||||||
|
|
||||||
**Hardware:**
|
**Hardware:**
|
||||||
|
|
||||||
* Adafruit `Device Description
|
* `Adafruit Device Description
|
||||||
<hyperlink>`_ (Product ID: <Product Number>)
|
<hyperlink>`_ (Product ID: <Product Number>)
|
||||||
|
|
||||||
**Software and Dependencies:**
|
**Software and Dependencies:**
|
||||||
|
|
||||||
* Adafruit CircuitPython firmware for the supported boards:
|
* Adafruit CircuitPython firmware for the supported boards:
|
||||||
https://circuitpython.org/downloads
|
https://circuitpython.org/downloads
|
||||||
|
|
||||||
* Adafruit's Bus Device library:
|
* Adafruit's Bus Device library:
|
||||||
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
|
https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
|
||||||
|
|
||||||
* Adafruit's Register library:
|
* Adafruit's Register library:
|
||||||
https://github.com/adafruit/Adafruit_CircuitPython_Register
|
https://github.com/adafruit/Adafruit_CircuitPython_Register
|
||||||
|
|
||||||
@ -525,6 +527,51 @@ SPI Example
|
|||||||
spi.readinto(self.buf)
|
spi.readinto(self.buf)
|
||||||
return self.buf[0]
|
return self.buf[0]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Class example template
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
When documenting classes, you could use the following template to illustrate the basic class functioning.
|
||||||
|
it is closely related with the simpletest, however this will display the information in the readthedocs
|
||||||
|
documentation.
|
||||||
|
The advantage of using this, is users will be familiar with this as it is used across libraries
|
||||||
|
|
||||||
|
This is an example for a AHT20 temperature sensor. You could locate this after the class parameter
|
||||||
|
definitions.
|
||||||
|
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
**Quickstart: Importing and using the AHT10/AHT20 temperature sensor**
|
||||||
|
|
||||||
|
Here is an example of using the :class:`AHTx0` class.
|
||||||
|
First you will need to import the libraries to use the sensor
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
import board
|
||||||
|
import adafruit_ahtx0
|
||||||
|
|
||||||
|
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
|
||||||
|
aht = adafruit_ahtx0.AHTx0(i2c)
|
||||||
|
|
||||||
|
Now you have access to the temperature and humidity using
|
||||||
|
the :attr:`temperature` and :attr:`relative_humidity` attributes
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
temperature = aht.temperature
|
||||||
|
relative_humidity = aht.relative_humidity
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
Use composition
|
Use composition
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user