Skip to content

Commit 109136d

Browse files
authored
Merge pull request #24 from jposada202020/improving_docs
improving_docs
2 parents 7cf953c + e77224e commit 109136d

File tree

5 files changed

+44
-11
lines changed

5 files changed

+44
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ _build
77
*.pyc
88
.env
99
bundles
10+
.idea

README.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,32 +56,31 @@ Usage Example
5656

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

59-
.. code:: python
59+
.. code:: python3
6060
6161
import adafruit_max31855
6262
6363
You also need to create an SPI interface object, and a pin object for the
6464
chip select pin. You can use any pin for the CS, but we use D5 here:
6565

6666

67-
.. code:: python
67+
.. code:: python3
6868
69-
from busio import SPI
7069
from digitalio import DigitalInOut
7170
import board
7271
73-
spi = SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
72+
spi = board.SPI()
7473
cs = DigitalInOut(board.D5)
7574
7675
Next, just create the sensor object:
7776

78-
.. code:: python
77+
.. code:: python3
7978
8079
sensor = adafruit_max31855.MAX31855(spi, cs)
8180
8281
And you can start making measurements:
8382

84-
.. code:: python
83+
.. code:: python3
8584
8685
print(sensor.temperature)
8786

adafruit_max31855.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# SPDX-License-Identifier: MIT
44

55
"""
6-
``adafruit_max31855``
6+
`adafruit_max31855`
77
===========================
88
99
This is a CircuitPython driver for the Maxim Integrated MAX31855 thermocouple
@@ -21,9 +21,11 @@
2121
2222
**Software and Dependencies:**
2323
24-
* Adafruit CircuitPython firmware for the ESP8622 and M0-based boards:
25-
https://github.com/adafruit/circuitpython/releases
24+
* Adafruit CircuitPython firmware for the supported boards:
25+
https://circuitpython.org/downloads
26+
2627
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
28+
2729
"""
2830
import math
2931

@@ -41,6 +43,36 @@
4143
class MAX31855:
4244
"""
4345
Driver for the MAX31855 thermocouple amplifier.
46+
47+
:param ~busio.SPI spi: The SPI bus the MAX31856 is connected to.
48+
:param ~microcontroller.Pin cs: The pin used for the CS signal.
49+
50+
51+
**Quickstart: Importing and using the MAX31855**
52+
53+
Here is an example of using the :class:`MAX31855` class.
54+
First you will need to import the libraries to use the sensor
55+
56+
.. code-block:: python
57+
58+
import board
59+
from digitalio import DigitalInOut, Direction
60+
import adafruit_max31855
61+
62+
Once this is done you can define your `board.SPI` object and define your sensor object
63+
64+
.. code-block:: python
65+
66+
spi = board.SPI()
67+
cs = digitalio.DigitalInOut(board.D5) # Chip select of the MAX31855 board.
68+
sensor = adafruit_max31856.MAX31855(spi, cs)
69+
70+
71+
Now you have access to the :attr:`temperature` attribute
72+
73+
.. code-block:: python
74+
75+
temperature = sensor.temperature
4476
"""
4577

4678
def __init__(self, spi, cs):

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Table of Contents
2323
.. toctree::
2424
:caption: Tutorials
2525

26+
MAX31855 Thermocouple Learning Guide <https://learn.adafruit.com/thermocouple/>
27+
2628
.. toctree::
2729
:caption: Related Products
2830

examples/max31855_simpletest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33

44
import time
55
import board
6-
import busio
76
import digitalio
87
import adafruit_max31855
98

10-
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
9+
spi = board.SPI()
1110
cs = digitalio.DigitalInOut(board.D5)
1211

1312
max31855 = adafruit_max31855.MAX31855(spi, cs)

0 commit comments

Comments
 (0)