cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 Discovery get Acceleration value (integer)

ahsankhushe
Associate II
Posted on August 28, 2013 at 19:57

Hi

Can any one tell me how to get the acceleration value ? I want to calculate the distance by using it.

Thanks.

#stm32f4-discovery #clive1
5 REPLIES 5
Posted on August 28, 2013 at 20:19

Have you worked the following example?

\STM32F4-Discovery_FW_V1.1.0\Project\Peripheral_Examples\MEMS\main.c

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ahsankhushe
Associate II
Posted on August 28, 2013 at 20:34

Yeah , but in this example only light toggled with respect to direction of acceleration. I want the value of acceleration in x,y and z-axis so that i could calculate the distance from it.

ahsankhushe
Associate II
Posted on August 28, 2013 at 20:36

Actually i am making a device like odometer. So my need is to get the distance when the stm32f4 is move.

Thanks.

Posted on August 28, 2013 at 22:10

Ok, but this is your project, you'll need to modify this other one that demonstrates talking to the accelerometer

LIS302DL_Read(Buffer, LIS302DL_OUT_X_ADDR, 6);
XOffset = Buffer[0];
YOffset = Buffer[2];
ZOffset = Buffer[4];

You might need to read the

http://www.eng.auburn.edu/~nelson/courses/elec5260_6260/LIS302DL%20MEMS%20Accelerometer.pdf

for the part to configure it the way you want.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ahsankhushe
Associate II
Posted on August 29, 2013 at 10:30

Ok thanks but i am totally novice to stm and i am confused about some things and these are :

what is going to be stored in buffer[1] , buffer[3] , and buffer[5] ?

what values are actually being read in Xoffset , Yoffset , Zoffset ?