SPI.transfer

Name
SPI.transfer - Transfer the desired byte over SPI. A byte transmission also implies the reception of one byte, the meaning of the received byte depends of the slave device.

Equivalent to SPI.write

Description

 * Since Beta X

Syntax
char data_in = SPI.transfer(char data_out)

Example
A function to write a value in the register address to a SPI slave device:

void writeRegister(char address, char value) {    // take the chip select high to select: digitalWrite(chipSelectPin, LOW); SPI.transfer(address); //Send register location SPI.transfer(value);   //Send value to record into register // take the chip select high to de-select: digitalWrite(chipSelectPin, HIGH); }