/ README.rst
README.rst
  1  Introduction
  2  =============
  3  
  4  .. image:: https://readthedocs.org/projects/adafruit-circuitpython-max31855/badge/?version=latest
  5      :target: https://circuitpython.readthedocs.io/projects/max31855/en/latest/
  6      :alt: Documentation Status
  7  
  8  .. image:: https://img.shields.io/discord/327254708534116352.svg
  9      :target: https://adafru.it/discord
 10      :alt: Discord
 11  
 12  .. image:: https://github.com/adafruit/Adafruit_CircuitPython_MAX31855/workflows/Build%20CI/badge.svg
 13      :target: https://github.com/adafruit/Adafruit_CircuitPython_MAX31855/actions/
 14      :alt: Build Status
 15  
 16  CircuitPython driver for the `MAX31855 Thermocouple Amplifier Breakout <https://www.adafruit.com/product/269>`_
 17  
 18  Dependencies
 19  =============
 20  This driver depends on:
 21  
 22  * `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
 23  * `Bus Device <https://github.com/adafruit/Adafruit_CircuitPython_BusDevice>`_
 24  
 25  Please ensure all dependencies are available on the CircuitPython filesystem.
 26  This is easily achieved by downloading
 27  `the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
 28  
 29  Installing from PyPI
 30  ====================
 31  
 32  On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
 33  PyPI <https://pypi.org/project/adafruit-circuitpython-max31855/>`_. To install for current user:
 34  
 35  .. code-block:: shell
 36  
 37      pip3 install adafruit-circuitpython-max31855
 38  
 39  To install system-wide (this may be required in some cases):
 40  
 41  .. code-block:: shell
 42  
 43      sudo pip3 install adafruit-circuitpython-max31855
 44  
 45  To install in a virtual environment in your current project:
 46  
 47  .. code-block:: shell
 48  
 49      mkdir project-name && cd project-name
 50      python3 -m venv .env
 51      source .env/bin/activate
 52      pip3 install adafruit-circuitpython-max31855
 53  
 54  Usage Example
 55  ==============
 56  
 57  Of course, you must import the library to use it:
 58  
 59  .. code:: python
 60  
 61      import adafruit_max31855
 62  
 63  You also need to create an SPI interface object, and a pin object for the
 64  chip select pin. You can use any pin for the CS, but we use D5 here:
 65  
 66  
 67  .. code:: python
 68  
 69      from busio import SPI
 70      from digitalio import DigitalInOut
 71      import board
 72  
 73      spi = SPI(clock=board.SCK, MISO=board.MISO, MOSI=board.MOSI)
 74      cs = DigitalInOut(board.D5)
 75  
 76  Next, just create the sensor object:
 77  
 78  .. code:: python
 79  
 80      sensor = adafruit_max31855.MAX31855(spi, cs)
 81  
 82  And you can start making measurements:
 83  
 84  .. code:: python
 85  
 86      print(sensor.temperature)
 87  
 88  The temperature is read in degrees Celsius (°C). You have to convert it to
 89  other units yourself, if you need it.
 90  
 91  
 92  Contributing
 93  ============
 94  
 95  Contributions are welcome! Please read our `Code of Conduct
 96  <https://github.com/adafruit/Adafruit_CircuitPython_MAX21855/blob/master/CODE_OF_CONDUCT.md>`_
 97  before contributing to help this project stay welcoming.
 98  
 99  Documentation
100  =============
101  
102  For information on building library documentation, please check out `this guide <https://learn.adafruit.com/creating-and-sharing-a-circuitpython-library/sharing-our-docs-on-readthedocs#sphinx-5-1>`_.