Complete the code to import the spidev library.
import [1]
The spidev library is imported using import spidev.
Complete the code to create an SPI object.
spi = [1].SpiDev()You create an SPI object by calling SpiDev() from the spidev module.
Fix the error in opening SPI bus 0, device 1.
spi.open([1], 1)
The SPI bus number is usually 0 or 1. To open bus 0, device 1, use spi.open(0, 1).
Fill both blanks to set SPI max speed to 1 MHz and mode to 0.
spi.max_speed_hz = [1] spi.mode = [2]
Set max_speed_hz to 1,000,000 for 1 MHz speed and mode to 0 for SPI mode 0.
Fill all three blanks to write bytes [0x01, 0x02, 0x03] and read response.
response = spi.xfer2([1]) print([2]) [3].close()
Use spi.xfer2([0x01, 0x02, 0x03]) to send bytes and get the response. Then print the response variable. Finally, close the SPI connection with spi.close().
