C

The next code would help to understand more about this sensor, and how we can retrieve information.

First we need to import the libraries to use this feature on the XDK.

XdkSensorHandle.h

/************************************************************
*   AccelerationSensor.c
************************************************************/

/* system header files */
#include <stdio.h>

/* additional interface header files */
#include "FreeRTOS.h"
#include "timers.h"
#include "BCDS_CmdProcessor.h"
#include "BCDS_Assert.h"

#include "XdkSensorHandle.h"

We are going to use two functions, that are going to help us to read the value of the accelerometer.

Accelerometer_readXyzGValue()

Accelerometer_readXyzLsValue()

Both functions will help us to provide data but with different unit. The first function provides data that is measured in earth acceleration g. Additionally the physical data is stored in 32 bit integers and therefore measured in mili g.

The second functions provides the analog sensor data converted into its raw digital.

We need to initialized the sensor

Finally we declared the main part of the program where we need to call all the function that we previously defined. Also define the timers.

Last updated

Was this helpful?