From b3fed3db83d908d2f746ce7b52b27fe1d155d951 Mon Sep 17 00:00:00 2001 From: Pierrick C Date: Sun, 29 Mar 2020 18:04:38 +0200 Subject: [PATCH] Update README.rst and example --- README.rst | 38 ++------------------------------- examples/max31865_simpletest.py | 17 +++++++++------ 2 files changed, 12 insertions(+), 43 deletions(-) diff --git a/README.rst b/README.rst index 54c8f71..bda176d 100644 --- a/README.rst +++ b/README.rst @@ -10,47 +10,13 @@ Introduction :target: https://discord.gg/nBQh6qu :alt: Discord -.. image:: https://github.com/adafruit/Adafruit_CircuitPython_MAX31865/workflows/Build%20CI/badge.svg - :target: https://github.com/adafruit/Adafruit_CircuitPython_MAX31865/actions/ - :alt: Build Status - -CircuitPython module for the MAX31865 thermocouple amplifier. +Micropython port of the CircuitPython module for the MAX31865 thermocouple amplifier. Dependencies ============= This driver depends on: -* `Adafruit CircuitPython `_ -* `Bus Device `_ - -Please ensure all dependencies are available on the CircuitPython filesystem. -This is easily achieved by downloading -`the Adafruit library and driver bundle `_. - -Installing from PyPI -===================== -On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from -PyPI `_. To install for current user: - -.. code-block:: shell - - pip3 install adafruit-circuitpython-max31865 - -To install system-wide (this may be required in some cases): - -.. code-block:: shell - - sudo pip3 install adafruit-circuitpython-max31865 - -To install in a virtual environment in your current project: - -.. code-block:: shell - - mkdir project-name && cd project-name - python3 -m venv .env - source .env/bin/activate - pip3 install adafruit-circuitpython-max31865 - +* `MicroPython `_ Usage Example ============= diff --git a/examples/max31865_simpletest.py b/examples/max31865_simpletest.py index 6e83594..7b9c8a2 100644 --- a/examples/max31865_simpletest.py +++ b/examples/max31865_simpletest.py @@ -2,17 +2,20 @@ # Will print the temperature every second. import time -import board -import busio -import digitalio - +import machine import adafruit_max31865 # Initialize SPI bus and sensor. -spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO) -cs = digitalio.DigitalInOut(board.D5) # Chip select of the MAX31865 board. -sensor = adafruit_max31865.MAX31865(spi, cs) +spi=machine.SPI( + -1, + sck=machine.Pin(14, machine.Pin.OUT), + mosi=machine.Pin(13, machine.Pin.OUT), + miso=machine.Pin(12, machine.Pin.OUT) + ) +spi.init(baudrate=115200, polarity=0, phase=1) +cs=machine.Pin(2) +sensor=adafruit_max31865.MAX31865(spi, cs) # Note you can optionally provide the thermocouple RTD nominal, the reference # resistance, and the number of wires for the sensor (2 the default, 3, or 4) # with keyword args: