# ADXL313 not working with ardouino

**URL:** <https://community.sparkfun.com/t/adxl313-not-working-with-ardouino/44418>\
**Category:** Distance\
**Created:** [September 6, 2022, 2:40pm UTC](https://community.sparkfun.com/t/adxl313-not-working-with-ardouino/44418 "2022-09-06T14:40:30Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![oussama.salim](https://avatars.discourse-cdn.com/v4/letter/o/65b543/32.png) [@oussama.salim](https://community.sparkfun.com/u/oussama.salim)\
**Post date:** [September 6, 2022, 2:40pm UTC](https://community.sparkfun.com/t/adxl313-not-working-with-ardouino/44418/1 "2022-09-06T14:40:30Z")

</div>

hello everyone ,

ADXL313 library is working only with ESP32 , but its not working with arduino uno.

whenever i try to upload the sketch i get this message :

In member function ‘boolean ADXL313::beginSPI(uint8\_t, SPIClass&)’:

error: no matching function for call to ‘SPIClass::begin(int&)’

\_spiPort-\>begin(\_CS);

static void begin();

what is the problem ?

---

<div class="post-metadata">

**Author:** ![bidrohini](https://avatars.discourse-cdn.com/v4/letter/b/ecae2f/32.png) [@bidrohini](https://community.sparkfun.com/u/bidrohini)\
**Post date:** [September 7, 2022, 12:48pm UTC](https://community.sparkfun.com/t/adxl313-not-working-with-ardouino/44418/2 "2022-09-07T12:48:44Z")

</div>

Where did you download the library from? Here?

[https://www.arduino.cc/reference/en/lib … o-library/](https://www.arduino.cc/reference/en/libraries/sparkfun-adxl313-arduino-library/)

---

<div class="post-metadata">

**Author:** ![con123](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@con123](https://community.sparkfun.com/u/con123)\
**Post date:** [April 1, 2023, 5:34am UTC](https://community.sparkfun.com/t/adxl313-not-working-with-ardouino/44418/3 "2023-04-01T05:34:55Z")

</div>

Hi!

I have the same issue.

I was using the library “SparkFun\_ADXL313\_Arduino\_Library-1.0.2” from the following link:

[https://www.arduino.cc/reference/en/lib](https://www.arduino.cc/reference/en/lib) … o-library/

would be great if somebody could help…

THX

Constantin

---

<div class="post-metadata">

**Author:** ![paulvha](https://avatars.discourse-cdn.com/v4/letter/p/65b543/32.png) [@paulvha](https://community.sparkfun.com/u/paulvha)\
**Post date:** [April 1, 2023, 2:13pm UTC](https://community.sparkfun.com/t/adxl313-not-working-with-ardouino/44418/4 "2023-04-01T14:13:53Z")

</div>

you can not pass a chip select pin. with a begin call. The ChipSelect pin is “hard” defined in the variant as ‘SS’ . it will work if you change

```auto
_spiPort->begin(_CS); 

```

to

```auto
_spiPort->begin();

```

I hope that is enough as by doing a quick look at the code I see it is using an old style of interacting with the SPI library. The Arduino AVR library has some backward-compatible calls and that might be enough for this work.

---

<div class="post-metadata">

**Author:** ![con123](https://avatars.discourse-cdn.com/v4/letter/c/c68b51/32.png) [@con123](https://community.sparkfun.com/u/con123)\
**Post date:** [April 3, 2023, 5:55pm UTC](https://community.sparkfun.com/t/adxl313-not-working-with-ardouino/44418/5 "2023-04-03T17:55:33Z")

</div>

Thank you for the fast response!

I must admit that my knowledge is not that professional 😉 how it should be…

I changed the call of the function in “SparkFunADXL313.cpp” and “SparkFunADXL313.h” but then other compiler errors occur.

Basically, want to communicate with the module via i2C and I’m running one of the examples “Example1\_BasicReadings.ino” that are delivered.

I was wondering if I’m doing something completely wrong, but all other sensor (e.g. BME680) are working fine…

THX Constantin
