Skip to content

Commit 4a851f5

Browse files
authored
Merge pull request #16 from jposada202020/improving_docs
Improving docs
2 parents 2ea2ef9 + 0b23141 commit 4a851f5

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

adafruit_thermistor.py

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,43 @@
4545

4646

4747
class Thermistor:
48-
"""Thermistor driver"""
48+
"""
49+
:param ~microcontroller.Pin pin: Analog pin used for the thermistor
50+
:param int series_resistor: resistance in series between you analog input and the
51+
thermistor, normally a 10K resistor is placed between VCC and the analog pin
52+
:param int nominal_resistance: nominal resistance of the thermistor. normally 10k
53+
:param int b_coefficient: thermistor's B coefficient. Typically this is a value in
54+
the range of 3000-4000
55+
:param bool high_side: indicates if the thermistor is connected on the high side or
56+
low side of the resistor. Defaults to `True`
57+
58+
59+
**Quickstart: Importing and using the adafruit_thermistor library**
60+
61+
Here is one way of importing the `Thermistor` class so you can use it
62+
with the name ``thermistor``.
63+
First you will need to import the libraries to use the sensor
64+
65+
.. code-block:: python
66+
67+
import board
68+
import adafruit_thermistor
69+
70+
Once this is done you can define your `Thermistor` object and define your sensor object
71+
72+
.. code-block:: python
73+
74+
thermistor = adafruit_thermistor.Thermistor(board.A0, 10000, 10000, 25, 3950)
75+
76+
Now you have access to the temperature with the :attr:`temperature` attribute.
77+
This temperature is in Celsius.
78+
79+
80+
.. code-block:: python
81+
82+
temperature = thermistor.temperature
83+
84+
"""
4985

5086
def __init__(
5187
self,
@@ -67,7 +103,7 @@ def __init__(
67103

68104
@property
69105
def temperature(self):
70-
"""The temperature of the thermistor in celsius"""
106+
"""The temperature of the thermistor in Celsius"""
71107
if self.high_side:
72108
# Thermistor connected from analog input to high logic level.
73109
reading = self.pin.value / 64

0 commit comments

Comments
 (0)