Hi,
I just wanted to confirm whether the following code is correct for sending out a byte of data (only once) using the SPI library in Arduino Nano.
I am asking so because I am very new to using Arduino and am facing some issues when using this for my project.
Thanks in advance.
#include <SPI.h>
uint8_t const ssFPGA = 10;
void setup()
{
Serial.begin(115200);
while (!Serial)
{
; // wait
}
SPI.begin();
pinMode( ssFPGA, OUTPUT );
}
void loop()
{
digitalWrite( ssFPGA, 0 );
delay( 10 );
SPI.beginTransaction( SPISettings(16000000, MSBFIRST, SPI_MODE3 ) );
{
SPI.transfer(0x12);
//SPI.transfer(0x34); // ------> for sending 2nd byte
//SPI.transfer(0x56); // ------> for sending 3rd byte
}
SPI.endTransaction();
digitalWrite( ssFPGA, 1 );
while(1);
}