Simple test¶
Ensure your device works with this simple test.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
# SPDX-License-Identifier: MIT
import board
import busio
import digitalio
import adafruit_max31856
# create a spi object
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
# allocate a CS pin and set the direction
cs = digitalio.DigitalInOut(board.D5)
cs.direction = digitalio.Direction.OUTPUT
# create a thermocouple object with the above
thermocouple = adafruit_max31856.MAX31856(spi, cs)
# print the temperature!
print(thermocouple.temperature)
|