Accelerometer code

We tried to use this code but this didn’t work.
We will appreciate any help.

Accelerometer code.rar (212 KB)


Accelerometer code.rar (212 KB)

You aren’t giving much information to go on. Can you be a little more specific than “this didn’t work”? What part of the code should we be looking for? What do you want it to do, and what is it doing instead?

Well we tried to base our code on what shown in the Example of AXDL345 i2c - We used the Open and Read methods they built.

(The part that you should probably inspect is the teleop)

We wanted to get the acceleration from the accelerometer sensor, but the acceleration output (in the Teleop) returned 0.
We have double checked the wiring is exactly as shown in the example, so we know that is not the problem.
I hope this helps.
Thank you.

Ah, the infamous “accelerometer returns zero” issue. The code looks right at first glance.

What cable are you using between the cRIO’s DIO module and the Digital Sidecar? There are many reports of the white round-jacketed cable from previous years not working with I2C while a ribbon cable does. There’s also the possibility that a ribbon cable from this year’s Kit of Parts didn’t quite get fixed properly, and has some bad connections at the end where the I2C pins are.

First of all, thanks for the quick reply!
We have used the white round-jacketed cable from previous years and not the ribbon cable because the ribbon cable was destroyed when we tried to fix it (It had arrived broken in the KOP)… We are now trying to get a new ribbon cable.
I also tried to use the accelerometer with SPI, but it had the same problem (acceleration is always 0). Is it also because of the cable?

the code for the SPI try is attached.

AccelerometerSPI_TRY.rar (212 KB)


AccelerometerSPI_TRY.rar (212 KB)