Logic for counting steps when walking using the accelerometer function in iphone

How can I use the accelerometer function in iPhone to calculate distances while walking?

+4
source share
2 answers

You cannot use the accelerometer to determine the distance.

If I'm at rest, the accelerometer only detects acceleration due to gravity. This obviously set the walking distance to 0.

But if I go at a constant speed and run the application while walking, my acceleration is also zero, so the accelerometer again only detects acceleration due to gravity. The situation is the same as above, and the walking distance is 0, which is incorrect.

Not to mention the difficulties in working with changes in acceleration due to the orientation of the device.

You need Core Location to calculate everything related to distance. You can use the accelerometer to implement a pedometer, but it only takes steps, not distance.

+2
source

It might be wiser to use Core Location for this.

In fact, an example application for calculating walking distance and speed is created in Chapter 24 of the iPhone iPhone API SDK Development by Bill Dudney and Chris Adamson.

+1
source

All Articles