Serial Peripheral Interface

I am using UNO and Mega.
I included the SPI.h library but the compiler does not recognize the SPI.beginTransaction() or the SPI.endTransaction(). It gives me the error "no matching function for call to 'SPIClass::beginTransaction(longint,int,int)'
What am I doing wrong? I thought I followed the SPI introductions on the web correctly.

Please post your code (in code tags) and all the error messages (also in code tags)

void setup() {//A
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  SPI.begin();//Start the SPI bus
  SPI.beginTransaction(10000000, MSBFIRST, SPI_MODE0);
  digitalWrite(SS,LOW);//activate the POT
  attachInterrupt(digitalPinToInterrupt(Int_pulse), ISR_1, RISING);

The error message is

no matching function for call to 'SPIClass::beginTransaction(longint,int,int)'

You missed out "SPISettings"

I used the following:
SPI.beginTransaction(SPISettings(10000000, MSBFIRST, SPI_MODE0));
and it seems to accept it.
According to the SPI introduction you use the SPI.beginTransaction(10000000, MSBFIRST, SPI_MODE0); as is?

Link, please.

No now I cannot find the link.
However, the correct construct works thank you.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.