Arduino Function: SPI.transfer


The Serial Peripheral Interface Bus or SPI bus is a synchronous serial data link standard named by Motorola that operates in full duplex mode. Devices communicate in a master/slave mode where the master device initiates the data frame. Multiple slave devices are allowed with individual slave select (chip select) lines using a pin for each device. The transfer() method exchanges bytes of data.


SPI.transfer(slaveSelectPin, val)(Arduino Due only)
SPI.transfer(slaveSelectPin, val, transferMode)(Arduino Due only)


  • val: the byte to send out over the bus
  • slaveSelectPin: slave device SS pin (Arduino Due only)
  • transferMode (Optional, Arduino Due only)
    • SPI_CONTINUE: keeps the SS pin low, allowing a subsequent byte transfer.
    • SPI_LAST: default if not specified the SS pin returns to high after one byte has been transferred.


 the byte read from the bus.

Based on the reference originally written by Arduino Community, and