Software problem with Hitachi H48C accelerometer
fmurphy
Posts: 6
I used a do loop to get 3 sequential readings of the x,y,and z axis.I can display:
·X axis Y axis Z axis
2058··· 2053·· 2509
2059··· 2051·· 2509
2057··· 2063·· 2507
(The readings are similar because the accelerometer is stationary)
I can't figure out how to subtract the first x axis reading from the·second and then the second from the third.
I do not want to store (write) because it is too slow. I would also like to display the variables: (2058- 2059)= -1·· etc.
·X axis Y axis Z axis
2058··· 2053·· 2509
2059··· 2051·· 2509
2057··· 2063·· 2507
(The readings are similar because the accelerometer is stationary)
I can't figure out how to subtract the first x axis reading from the·second and then the second from the third.
I do not want to store (write) because it is too slow. I would also like to display the variables: (2058- 2059)= -1·· etc.
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
If it is you'll have to store the previous value in memory. Use something like this:
Xprev VAR Word
Xnew VAR Word
DEBUG DEC (Xnew-Xprev)
every time you poll for the new data you first set Xprev=Xnew and then store the newest reading from the accelerometer in Xnew again