#include <SPI.h>
#define CS 10
void setup() {
Serial.begin(115200);
pinMode(CS, OUTPUT);
}
void loop() {
char sendData[] = "Uryyb, FCV! ";
char receivedData[sizeof(sendData)];
// SPI Transaction: sends the contents of sendData and overwrites it with the received data.
digitalWrite(CS, LOW);
SPI.begin();
SPI.transfer(sendData, sizeof(sendData) - 1); // Exclude the null terminator
SPI.end();
digitalWrite(CS, HIGH);
Serial.println("Data sent to SPI device:");
Serial.println(sendData);
// Print the received data
Serial.println("Data received from SPI device:");
Serial.println(sendData);
delay(1000); // Add a delay if needed
}