Skip to content

improving_docs #24

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 25, 2021
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ _build
*.pyc
.env
bundles
.idea
11 changes: 5 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,31 @@ Usage Example

Of course, you must import the library to use it:

.. code:: python
.. code:: python3

import adafruit_max31855

You also need to create an SPI interface object, and a pin object for the
chip select pin. You can use any pin for the CS, but we use D5 here:


.. code:: python
.. code:: python3

from busio import SPI
from digitalio import DigitalInOut
import board

spi = SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
spi = board.SPI()
cs = DigitalInOut(board.D5)

Next, just create the sensor object:

.. code:: python
.. code:: python3

sensor = adafruit_max31855.MAX31855(spi, cs)

And you can start making measurements:

.. code:: python
.. code:: python3

print(sensor.temperature)

Expand Down
38 changes: 35 additions & 3 deletions adafruit_max31855.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT

"""
``adafruit_max31855``
`adafruit_max31855`
===========================

This is a CircuitPython driver for the Maxim Integrated MAX31855 thermocouple
Expand All @@ -21,9 +21,11 @@

**Software and Dependencies:**

* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
https://github.com/adafruit/circuitpython/releases
* Adafruit CircuitPython firmware for the supported boards:
https://circuitpython.org/downloads

* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice

"""
import math

Expand All @@ -41,6 +43,36 @@
class MAX31855:
"""
Driver for the MAX31855 thermocouple amplifier.

:param ~busio.SPI spi: The SPI bus the MAX31856 is connected to.
:param ~microcontroller.Pin cs: The pin used for the CS signal.


**Quickstart: Importing and using the MAX31855**

Here is an example of using the :class:`MAX31855` class.
First you will need to import the libraries to use the sensor

.. code-block:: python

import board
from digitalio import DigitalInOut, Direction
import adafruit_max31855

Once this is done you can define your `board.SPI` object and define your sensor object

.. code-block:: python

spi = board.SPI()
cs = digitalio.DigitalInOut(board.D5) # Chip select of the MAX31855 board.
sensor = adafruit_max31856.MAX31855(spi, cs)


Now you have access to the :attr:`temperature` attribute

.. code-block:: python

temperature = sensor.temperature
"""

def __init__(self, spi, cs):
Expand Down
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ Table of Contents
.. toctree::
:caption: Tutorials

MAX31855 Thermocouple Learning Guide <https://learn.adafruit.com/thermocouple/>

.. toctree::
:caption: Related Products

Expand Down
3 changes: 1 addition & 2 deletions examples/max31855_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

import time
import board
import busio
import digitalio
import adafruit_max31855

spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
spi = board.SPI()
cs = digitalio.DigitalInOut(board.D5)

max31855 = adafruit_max31855.MAX31855(spi, cs)
Expand Down