#include <SPI.h>
#define CS 10
void setup() {
char buffer[] = "Hello World! ";
Serial.begin(115200);
pinMode(CS, OUTPUT);
// SPI Transaction: sends the contents of buffer, and overwrites it with the received data.
Serial.print("Dado enviado ao dispositivo SPI : ");
Serial.println(buffer);
digitalWrite(CS, LOW);
SPI.begin();
SPI.transfer(buffer, strlen(buffer));
SPI.end();
digitalWrite(CS, HIGH);
Serial.print("Dado recebido do dispositivo SPI:");
Serial.println(buffer);
}
void loop() {
}