Community news, upcoming events and general discussions
Threads: 32 Posts: 82
Get technical support from the community
Threads: 1182 Posts: 6590
Threads: 16 Posts: 58
Tell us how to make XDK better!
Threads: 35 Posts: 117
Share and discuss community member projects
Threads: 53 Posts: 256
This is my sample code for using the acclerator sensor. I need a bandwidth of 300HZ and range 2G. What are the changes that I should make in the coding to include these values.
Can someone modify the code and send include these values?
I also need the code to initialise my SD card and read all the values acquired from the acclerator sensor.
i'm glad to see my code snippet i posted in an earlier thread was helpful to you.
You are able to configure the bandwidth and range of the sensor by calling the BMA280_InitializeAccelerometer() function with the corresponding parameter. These parameter are enum types in the header file BCDS_Accelerometer.h . You can find this header in the path: YourProjectName/SDK/xdk110/Platform/Sensors/include/BCDS_Accelerometer.h.
If you want to set the bandwidth to 300Hz and the range to +-2G you have to call the Init function in your main programm like that:
Please notice there is no option to set the Sensor to a value of 300Hz. The two possibilities are 250Hz or 500Hz.
This should answer your first question.
In the next step you want to write the sensor data to a file on the SD card. To get a proper understand of the SD card and the usage of it, i recommend the corresponding learning section on the XDK Knowledge Base. There is a good tutorial you can follow up. I also recommend the learning section of this website. The tutorials are very helpful to start with a topic.
I hope i was able to answer your questions.