Error: 'arduino::SPIClass {aka class arduino::HardwareSPI}' has no member named 'setDataMode' _spi->setDataMode(SPI_MODE3);

Hi, can somebody help me with this error code of, I'm using MKRG GSM 1400. I'm able to succesfully running other few program on it. But using ADXL345 accelerometer and I'm struggling and getting errors at compile related to hardware SPI.
The error display are:

In member function 'bool ADXL345_WE::init()':
error: 'arduino::SPIClass {aka class arduino::HardwareSPI}' has no member named 'setDataMode'
_spi->setDataMode(SPI_MODE3);
maybe the library can be modified, but I have no Idea where?

does the setDataMode reference help?

The library isn't compatible with the MKR series of Arduinos because it uses the deprecated setDataMode() method. Current libraries should use the beginTransaction() method instead supplying an SPISettings object which also improves the usage of multiple SPI devices that needs different modes or speeds.

1 Like

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