Syntax
byte transfer(
    uint8_t _data
);
ContentsIndex
PreviousUpNext
SPIClass::transfer Method
SPIClass Class | Example
Syntax
byte transfer(
    uint8_t _data
);
Description

Sends a byte of data to slave and receives a byte of data from the slave simultaneously.

Parameters
Parameters 
Description 
uint8_t _data 
[IN] The data sent from master to slave. 
Returns

Data returned from slave to master.

Example
#include <SPI.h>
#define SS_PIN    10

void setup()
{
    pinMode(SS_PIN, OUTPUT);
    SPI.begin();    
}
void loop()
{
    byte ret_val;
    digitalWrite(SS_PIN, LOW);
    ret_val = SPI.transfer(100);
    digitalWrite(SS_PIN, HIGH);
    delay(1000);
}
File

SPI.h

Class