我一直试图读取我的树莓树上的热电偶温度,但是不能让树莓树与adafruit MAX 31856通信。我已经下载了必要的库,并检查了所有连接都是安全和正确的,但是当我试图执行此代码时,总是遇到此错误。
任何帮助都是非常感激的!
import board
import digitalio
import adafruit_max31856
spi = board.SPI()
cs = digitalio.DigitalInOut(board.D5)
cs.direction = digitalio.Direction.OTUPUT
thermocouple = adafruit_max31856.MAX31856(spi,cs)
print(thermocouple.temperature)
错误:
Traceback (most recent call last):
File "/home/pi/test4.py", line 6, in <module>
spi = board.SPI()
File "/usr/local/lib/python3.7/dist-packages/board.py", line 299, in SPI
return busio.SPI(SCLK, MOSI, MISO)
File "/usr/local/lib/python3.7/dist-packages/busio.py", line 289, in __init__
self._spi = _SPI(portId)
File "/usr/local/lib/python3.7/dist-packages/adafruit_blinka/microcontroller/generic_linux/spi.py", line 25, in __init__
self._spi = spi.SPI(device=(portid, 0))
File "/usr/local/lib/python3.7/dist-packages/Adafruit_PureIO/spi.py", line 167, in __init__
raise IOError("{} does not exist".format(device))
OSError: /dev/spidev0.0 does not exist
代码错误
很可能存在为sp0 -0加载的设备驱动程序,它删除了/dev/spidev0.0设备。检查你的/boot/config.txt覆盖加载MAX 31856驱动程序模块。如果你想使用adafruit_max31856库,你不应该加载这个驱动程序。希望能有所帮助