Description
(optional) Device-specific library
import board
import busio
import digitalio
import adafruit_bme280
# Setup the SPI connection
cs = digitalio.DigitalInOut(board.xSDCS)
spi = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)
# Setup the SPI device
bme280 = adafruit_bme280.Adafruit_BME280_SPI(spi, cs)
print("\\nTemperature: %0.1f C" % bme280.temperature)
print("Humidity: %0.1f %%" % bme280.humidity)
print("Pressure: %0.1f hPa" % bme280.pressure)
SPI is a three-wire communication protocol. Read more here and here
SAM32 has lots of pins that can be configured for SPI. The default are shown to the right.
default pin names are:
board.MOSI
board.SCK
board.MISO
to learn more about configuring pins for different hardware functions, see: Pin Muxing