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 15, 2021
Merged
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
40 changes: 38 additions & 2 deletions adafruit_thermistor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,43 @@


class Thermistor:
"""Thermistor driver"""
"""
:param ~microcontroller.Pin pin: Analog pin used for the thermistor
:param int series_resistor: resistance in series between you analog input and the
thermistor, normally a 10K resistor is placed between VCC and the analog pin
:param int nominal_resistance: nominal resistance of the thermistor. normally 10k
:param int b_coefficient: thermistor's B coefficient. Typically this is a value in
the range of 3000-4000
:param bool high_side: indicates if the thermistor is connected on the high side or
low side of the resistor. Defaults to `True`


**Quickstart: Importing and using the adafruit_thermistor library**

Here is one way of importing the `Thermistor` class so you can use it
with the name ``thermistor``.
First you will need to import the libraries to use the sensor

.. code-block:: python

import board
import adafruit_thermistor

Once this is done you can define your `Thermistor` object and define your sensor object

.. code-block:: python

thermistor = adafruit_thermistor.Thermistor(board.A0, 10000, 10000, 25, 3950)

Now you have access to the temperature with the :attr:`temperature` attribute.
This temperature is in Celsius.


.. code-block:: python

temperature = thermistor.temperature

"""

def __init__(
self,
Expand All @@ -67,7 +103,7 @@ def __init__(

@property
def temperature(self):
"""The temperature of the thermistor in celsius"""
"""The temperature of the thermistor in Celsius"""
if self.high_side:
# Thermistor connected from analog input to high logic level.
reading = self.pin.value / 64
Expand Down