using accelerometer to determine if phone is at rest
I'm building an app using the Windows Phone 7 SDK and I've 开发者_如何学运维got a thread that is constantly returning X, Y, and Z accelerometer data. I need to determine at any given time whether the phone is moving or not. Can someone help me step through the logic/math needed for this?
Use a high-pass filter. Chose an alpha arbitrarily (0.3 seems as a good initial guess), and if y[i]
exceeds a threshold determined by your experiments then the phone is moving, otherwise it is not. Note that you only need to store the last y[i]
and the last measurement. Good luck!
精彩评论